“Hello world” in CSS?
Yes, you can! Thanks to this insightful article by Chris Coyier over at CSS-Tricks—athough this is more of an edge case. Here’s what he says:
body::after { content: "Hello, World!"; }
in style.css
file and open a web page that loads that <link>
, usually) isn’t even that different from how JavaScript is told to run (<script>
, usually).
So, to sum up:
body::after {
content: "Hello World!";
}
can produce something like this:
This is pretty obvious, but it just goes to show that… Hello World
. Of course,
CSS is a programming language! Here’s why
CSS selectors are simplyif
statements running over loops of matchescalc()
is a direct implementation of math (check this!)- Media queries are switches
- Custom properties are a place to store states
:checked
is a boolean
And, my own contribution: Aren’t !important
and @supports
both proof that
Chris asserts that the bigger picture is about pay. His concern: If