CSS can be really challenging — but it's hard for me to nail down what exactly makes it so. Would love to spark a conversation!
For further actions, you may consider blocking this person and/or reporting abuse
CSS can be really challenging — but it's hard for me to nail down what exactly makes it so. Would love to spark a conversation!
For further actions, you may consider blocking this person and/or reporting abuse
Mafuzur Rahman -
Jon Snow -
Charlie from IdeaHub -
Leetcode -
Once suspended, sherrydays will not be able to comment or publish posts until their suspension is removed.
Once unsuspended, sherrydays will be able to comment and publish posts again.
Once unpublished, all posts by sherrydays will become hidden and only accessible to themselves.
If sherrydays is not suspended, they can still re-publish their posts from their dashboard.
Once unpublished, this post will become invisible to the public and only accessible to Sherry Day.
They can still re-publish the post if they are not suspended.
Thanks for keeping DEV Community safe. Here is what you can do to flag sherrydays:
Unflagging sherrydays will restore default visibility to their posts.
Top comments (49)
Maybe it's because you've not been taught it properly? Did you learn the foundations first and build your knowledge steadily on top of them? Or do you just grab a bag of properties and start applying them to elements until your page looks right?
I don't know how the OP will take this statement, but it does seem a bit condescending. CSS is not something you can perfectly tackle every time. You can improve on it with steady practices of using frameworks and organization, but there will always be something getting in your way (like another library's styles using !important or being applied at unexpected places).
The most difficult thing about CSS is that the order of importance, inclusion, and extension is extremely important, and most people do not have a proper way to make sure it is applied correctly 100% of the time. It's not necessarily about "not being taught properly", as "properly" is difficult to do if the 3rd party libraries don't do it "properly" either.
but it does seem a bit condescending --> It's not but it's indeed the truth. I came here in a hope to find such a message and you reply also confirms what Nicholas said.
Frameworks and other tools are not doing the job correctly by promoting bad practices and wrong advises. Beginners will, unfortunately, get trapped there so the conclusion is --> you've not been taught it properly
When a framework is telling you that the future is to write inline styles and to stop separating the style from the content then for sure CSS will be very hard.
If on a Twitter a lot of "Grifters" are claiming that you can learn CSS in 1 Week and become a Front End developer in 3 months then for sure you will get frustrated and find CSS hard because it's impossible to learn CSS in 1 Week.
There are multiple reasons for that.
I think one of the reasons is that it requires a different mental model compared to "normal programming" - programming in a language like Javascript or PHP is imperative - "first do this then do that" ... CSS is declarative - you declare the desired end result, and somehow the "engine" figures out how to get that result.
But what if the result isn't what you intended? With a language like Javascript or PHP there are ways to debug it - with CSS much less so, you then need to mentally 'debug' why CSS would have arrived at result B while you wanted A. And to do that you need to know the "rules" used by CSS - and the rules are many and complex, because CSS is huge.
One of the most complex topics in this regard with CSS is layout - CSS has at least 3 completely different layout "engines" built in (off the top of my head, "float", "flex box" and "grid", and probably I forgot one) each with their own set of rules. Just look at the number of Stackoverflow posts where people ask how to center something vertically, it's astronomical. Until "flex box" came along the ways to do this were often very unintuitive (using negative margins or something like that).
Second reason is because it was originally not designed with "app" development in mind - it was purely for document layout. Web 1.0 was static with simple layouts and minimal interactivity, then with Web 2.0 people were trying to do things with it for which it wasn't designed - hence the multitude of complex hacks that are typical for CSS (see remark above about vertically centering something).
Third reason is because it evolved a lot over the years (and is still evolving) - see example above with the layout models - originally there was only "float", then "flex" was added, then "grid". And one of the reasons why it evolved is because of the previous point - because it was starting to get used for things that it wasn't originally designed for, like developing "apps" - things then started to get added to the CSS standard to fill those gaps and shortcomings.
And the final reason why it's complex is just because it's huge - means it takes a long time to master. And the reason why it's huge is partially because of what I just mentioned - the standard evolved and new things got added - but, old things never get removed, so CSS keeps growing and growing.
So to summarize why I think CSS is hard to master:
I think people assume that it's really easy, when in fact it's pretty complex.
I'd say learn the basics first, get into dev tools and see how other sites do the things you want to learn. I find making components in Codepen or a separate project help you not get overwhelmed when focusing on something that seems complex (as the cascade part of CSS is part of the complexity)
I really like the content by joshwcomeau.com he explains stuff so well, so you understand the fundamentals on why things work. This article in particular is awesome, helps you understand layout algorithms.
At one time, the team that I was on became very CSS savvy, since it was important for our product that the UI worked well, and the UI leaned on CSS heavily.
(The product was called Internet Explorer. It used to be popular, once upon a time. The team I was on worked on the F12 developer tools for IE10 and IE11.)
That is a great way to describe this madness 😵💫
I'm tempted to frame this and stick it on the wall behind me in my office...with attribution of course. 🙃
Make it authentic with a brightly colored offset border and clipped text to show you were screwing with the alignment while making it 😂
Css feels a lot low level and it's challenging to make sth look great from scratch, that's why tou see libraries trying to simplify the process such as tailwind and bootstrap like you see react for javascript
I totally agree. If you're just starting out or you don't consider yourself an expert, libraries like Tailwind and Bootstrap really give you constraints and help you get started. Later on you can get more creative once you get the hang of it (with or without libraries).
But most people suggest that you learn css before a library
With the
bootstrap
direction I cringe every time I see people useflex
asclass
-es. Basically you have to know and writeflex
to be able to use theflex
utility classes. Then why not writeflex
in a stylesheet in the first place?Difference between devices and browsers. I tried to do mobile-first design and it's very wide on desktop. Some elements must be hidden when the viewport reaches a specific width or height. Some elements are totally different on mobile and desktop. For example, a navigation bar may be just a horizontal bar on desktop but a bar with dropdown on mobile. There are so many things to consider.
In my opinion:
Here's my tips for working with CSS:
contact-form-send-button
class. Have abutton--submit
class instead.js-
eg :js-close-btn
.My experience with
bootstrap
and design systems were a super overblown CSS ruleset, over a Mb bundled for every team's frontend part. So people crossing parts in the application meant to download those CSS bundles.Of course, if people would have better knowledge over CSS and CSS tooling they could have just broken it up to have a separate CSS for just the design system, and one for their own app.
Then you have another problem of however modular and smart is your system, UX and UI design will figure out something unique: you should make exceptions for the customers. So in the end you will have a big, bloated design system for every use case, yet you are regularly writing exceptions, overrides and custom elements for actual use cases.
On the other side, a design system and existing elements are extremely productive. But it requires some really great CSS developers to find the right balance.
There is also a problem of
CSS
being alowly
thing that people just don't learn properly. And then they start to force the same methodologies that only work in the language they have learned them (e.g. a Java class oriented system in Java, a functional approach in JS). ButCSS
is designed totally differently, you can't "reuse" the same tricks from other languages.every-layout.dev/rudiments/global-...
It's a different paradigm.
Where more conventional languages are imperative (you describe how something should work), CSS is declarative (you describe, what you want as a result).
Most programmers are taught how to tell a computer how to do things, but not how to conceptualize a final result, that being traditionally more in the space of designers and artists. That means, you can probably jump easily from JS to PHP to C, but need to rethink a lot for CSS.
CSS has too many properties, and when I say 'too many', me means 'too many'. Like you always have multiple ways to achieve the same thing while working on CSS, so learning 'everything' is just next to impossible, or for me atleast. For example, if you want to horizontally center an element in a container, you can do
margin: 0 auto;
or you also have an option forposition: relative; left: calc(50% - width px)
...I take no blame/credit for IE6! I was on IE10 and IE11.
At the time, Edge was so hush-hush that those of us on IE11 where completely unawares it was in the works. While working on IE10 and IE11, me and my coworkers often commented how IE should just start over... apparently someone up the chain in a position of authority had the same notion, and Edge was born.
(Some of the tech in IE was rock solid, like Triton engine and Chakra engine. For fun, we plumbed up Node.js to use Chakra instead of V8. Surprisingly easy to do, about 10 minutes of work.)
Mybe it´s worth looking back to the roots of CSS.
HTML and CSS have been invented in a time, where networks had a very limited capacity and people used acoustic modems on a telephone line to access the internet. HTML some features to make documents more readable (like headlines and bold face) with a minimal overhead, but you could not even use color (because people at CERN had only monochrome displays).
To make document more readable, CSS was the perfect solution. Instead of adding format information to every part of the document, CSS simply changes how the machine works: You only define once to make all headlines red, not for every headline you use.
This was really efficient so save bandwidth, but gave you some headache if you need special formatting for a single item. That is where the trouble starts: You need to define some qualifiers like id´s in HTML and use them in CSS (or - if you like - define some classES in CSS and use it in HTML). That gives you a serious amount of overhead, if you want to apply CSS to a single element and makes things hard to maintain. You can use inline styles instead, but that makes it even harder to maintain. And - may have some serious unwanted side effects too.
CSS has some serious design flaws. Most of all:
There have been several attempts to solve this, but most of them seem to solve one problem but give you two new headaches.
The only thing you can say about CSS is: It is like it is. I´m pretty sure that - if somebody had to invent a new internet from scratch on a current hardware - things would look very different from what we see today.
In my opinion CSS was much harder back in the day when everybody was forced to use floats and clearfix to put together a design. Or even worse in the dark days of web development when everybody used tables.
Now with flexbox and css grid its much easier.