I don't think CSS is any less logical... but some might not be use to _declarative_ languages like CSS is?
I don't think CSS is any less logical... but some might not be use to _declarative_ languages like CSS is?
With CSS, you can't avoid hacks. If you try to design anything non-trivial, you will have to employ tricky non-semantic tricks, run into edge cases, and have to settle on ugly, non-optimal solutions.
I don't think it's a declarative vs imperative thing. It's more that CSS was designed to be easy to use and relatively terse for a specific, outdated use case (20+ years ago when a website page was thought as a 1 dimensional flow of text and pictures).
Nowadays our requirements encompass pretty much the full spectrum of 2D space design, yet we still use a language that builds on high level primitives designed for a narrow usecase.
New features like Flexbox and CSS Grid help with the layout part, but it's not enough.
Here's the thing though — most websites are still just a '1 dimensional flow of text and pictures'. They try to disguise it with multiple columns of guff, but it's still just text and images. Sometimes a video.
Sure there are web 'apps' now too, but most websites are not apps (thankfully).
The thing is, web apps are also just a more complex version of the same '1 dimensional flow of text and pictures,' just maybe with Canvas and a lot of javascript. There's no real difference between a web app and a document, as far as HTML/JS/CSS is concerned. The dirty secret of the whole "the web used to be documents but now it's applications" meme is that the applications are still documents.
Just... use the constructs you're familiar with? It's not like you can "accidentally" use an ES6 class or something.
You can know about for..in without knowing about hasOwnProp.
You can forget to enable strict mode.
The list goes on. Static analysis is universally a good thing.
I don't think it is caused by this aspect of CSS.
The problem could come from the fact that it mixes 2 purposes: style AND layout to apply it globally with rules that get harder to understand the bigger the project.