DEV Community

Sherry Day
Sherry Day

Posted on

What makes CSS so hard?

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!

Oldest comments (41)

Collapse
 
warwait profile image
Parker Waiters

One part is that CSS is a native language of the browser. Working directly with it is always going to be a little tougher than something carefully designed to compile to CSS — but then you have to deal with build tools. It's a frustrating tradeoff.

Collapse
 
pontakornth profile image
Pontakorn Paesaeng

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.

Collapse
 
alohci profile image
Nicholas Stimpson

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?

Collapse
 
jwhenry3 profile image
Justin Henry

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.

Collapse
 
afif profile image
Temani Afif

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.

Collapse
 
seek4samurai profile image
Gourav Singh Rawat

No matter how hard it is, just grind and keep learning!!! Good luck.

Collapse
 
jsn1nj4 profile image
Elliot Derhay

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. 🙃

Collapse
 
marissab profile image
Marissa B

Make it authentic with a brightly colored offset border and clipped text to show you were screwing with the alignment while making it 😂

Collapse
 
collimarco profile image
Marco Colli

CSS is hard:

  • to keep organized
  • because it's responsive
Collapse
 
landb profile image
Branko Stancevic

CSS for me is just a tool that you can learn like anything else in programming... Understanding how CSS impact on the page's feel and look and on top of that performance - is just another level.

Collapse
 
jwp profile image
JWP

Css is hard: 'all I want is this thing to be here when that happens...' simple wish but requires internals knowledge and or methodology in the sea of recommendations of how to do it.

Sifting through the years of articles often leaves more confusion than before. This means we have to discover what works for us. That is complicated because different screen sizes render differently. Even different browsers render differently. Css offers few magic bullets for that problem. We are forced to manually code up Css for each size.

A few tools, such as SCSS and the Grid or Flexbox help but it still requires skills to gain mastery. Practice is the only way there along with reading sites
like CssTricks.

Finally, CSS is a DSL which I consider to be a half baked language. Because of this, it has virtually no ability to refactor. This is the primary reason for messy CSS and monolithic messes.

CSS is to me the worst part of all Website development. I dislike it greatly.

Collapse
 
ianbromwich profile image
Ian B • Edited

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.

Collapse
 
iamschulz profile image
Daniel Schulz

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.