4 ms·
I have a love-hate relationship with CSS. It's now been 18 years since I learned it and I still regularly get bitten by - browser incompatibilities (Last bug I
by codethief 6y ago
I have a love-hate relationship with CSS. It's now been 18 years since I learned it and I still regularly get bitten by
- browser incompatibilities (Last bug I fought: top/left/right/bottom behave differently in Chrome vs. Firefox when `position: sticky`. Fantastic.)
- messy refactorings: Sure, CSS3 variables are nice but you can still tell that they were bolted onto the language. Moreover, elements and their rules can interact in lots of ways and CSS code (especially code by other people haha) often doesn't make these interactions immediately clear. Besides, everything is global state and IDs and classes are the only way modularize CSS code.
- the fact that it's impossible to use HTML only for semantics and do all the layouting in CSS. (Wrapper divs, I'm looking at you!)
- weird precedence of CSS rules / specificity (https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity)
- missing type separation and missing type checks. All CSS properties live in the same namespace and may or may not interact with one another. For instance, top/left/bottom/right, margin etc. behave completely differently depending on what you set `position` and `display` to.
Things are getting better with web components now but I'm still not sure I'll ever be entirely happy with CSS.