While CSS and HTML are not a programming language as such, being able to masterfully craft things with them requires a level of logical and creative thinking which is perhaps in some ways harder than "proper" programming. Let me explain…
A programming language tends to have very clear logic to allow "if X, do Y" type things. HTML & CSS also allow you to define "if X, do Y" type things, but through a nightmarish abstraction of a nested document tree and some declarations about how the things in that tree behave.
This is further complicated by some of those behaviours cascading down the tree (e.g. box-sizing) and some not (e.g. border-color). Plus other weirdnesses, like the fact that specifying vertical padding as a percentage means a percentage of the width, not the height 🥴.
When you want to write the logic for "if the parent element is wide enough to sit both child elements side by side then spread them apart horizontally to far left and right, but if not then stack them on top of each other both aligned left", you have to…
… do a load of creative brain work to translate that into the a set of HTML & CSS that will do what you want. It essentially requires imagining different possible solutions (sometimes crazy ones) and then thinking or testing if they will work.
I'm told that HTML & CSS (combined) are Turing Complete. So in theory you can use them to, say, programmatically generate the prime numbers between 1 and 100. But I bet that takes you a lot longer in HTML & CSS than in your favourite programming language.
I think that there's sometimes a tendency for (cynical) developers to conflate these things:
"CSS is limited"
"CSS is shit"
"CSS is not programming"
"CSS is easy"
CSS is in some ways very limiting. So it can be seen as basic or simple, and therefore "easy". But its limitations are what makes it *hard*.
You have to think creatively, because you can't just write a bunch of if/else statements to logic your way out of a corner. You have to think *creatively* as well as logically to dance your way out of a corner with only one shoe.
It's probably true that you're unlikely to build as complex systems in HTML & CSS as you might do in other languages, but I still think that there's a level of creative thinking required which is often overlooked.
Happy dancing.
/END
Share this Scrolly Tale with your friends.
A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.
