User:Zuhui/SI26/Weekly log/Why is CSS So Weird
On the web, the client controls the display.
In reality, we're designing for an unknown infinite canvas, and we don't have all the variables.
Rather than designing with this control over exactly what we should ship, we're designing for change and for movement and for adaptation. We know how to do this is not unfamiliar territory. We can make car seats that move forward and backward so that different people fit.
Seat belts do the same thing. We can broadcast color TV and watch it on a black-and-white television because the technology understands how to degrade gracefully in these ways.
So as a designer, I'm no longer controlling the output; I'm suggesting. And that's why CSS is a declarative language.
That means that rather than describing, as we might in JavaScript, the steps to take to recreate a specific outcome, I instead describe the intent of my outcome. What am I going for? What am I pushing towards?
And I'm trying to give the browser as much meaningful information as possible —subtext and implications— so that the browser can make smart decisions about what to do with those styles.
That's where things like Normal Flow, the way that block and inline elements flow together, and relative units allow us to create these relationships in a meaningful way so that the browser can make smart decisions.
It's an intentionally resilient system and resilient language where everything fails silently.
Browsers are supposed to understand everything they can and ignore everything else, and that's how we get this total backwards compatibility where the early website is still available on modern browsers because everything is resilient, everything is backwards compatible.
It also has to be intentionally contextual for this to work. Everything depends on not only the size of the screen but the type of interface.
How are you interacting with it? Is it a keyboard? Is it touch? Is it a braille keyboard? Is it headphones? Are you listening to websites? There are so many different interfaces that the same styles just wouldn't make sense across interfaces.
And so context is very important to CSS. And that's fundamentally different from most languages.
To quote John Allsopp from the year 2000, when CSS was first coming into browsers:
' "Really we can think of this as a bug of the system, or we can think of control as really a limitation of the printed page." '
It's a limitation of print that I can control everything in it, and if I hand my poster to somebody who can't see, they have no ability to read it. And it's a feature of the web that anybody can access it from any different device. That's actually a feature, and that's something that we should embrace and figure out how to use.
Even the modern web, even the most powerful applications—desktop-style applications on the modern web—when we put them on the web, the reason to do that is we get universal device support. But the trade-off is we lose control, and that's a feature.