Why doesn't CSS include variables from the start (and still)?

I played with many useful tools like HAML and LESS that give CSS the ability to create variables. I am wondering why this feature was not enabled when running CSS. Is it too redundant or for some reason not necessary?

+7
variables css
source share
4 answers

I think because CSS was not perceived as a programming language. HTML also has no variables. Variables are often only considered truly necessary if you intend to manipulate them after they are created.

+2
source share

Bert Bos wrote his position on Why CSS Variables Are Harmful , The Other Side is Well Represented CSS Variables are the Future .

Bos' arguments range from weak to empty.

+2
source share

Cascading Style Sheets (CSS) are not a programming language. CSS was first designed as a means to create a consistent approach to providing style information for web documents. This goal has not changed since CSS1. It is used to describe the semantics of the presentation of a document for certain markup languages ​​(HTML, XHTML, XML, etc.).

Good thing you can create variables! One approach is to use a server-side language such as PHP and create some β€œdynamic CSS”. Now there are several ways to do this, and here are some sites about it ...

I find it useful to use "dynamic CSS." Here are some examples: you can allow users of the site to change some of its aspects, such as font size, you can more easily change the style of the site, you can offer different style themes for the site, etc. the possibilities are endless.

+1
source share

+1 for a good question. What you are asking for is not redundant and certainly at the top of the wish list of most CSS practitioners (along with the selector attachment).

I think this is another case with a very complex standard that scanned to the finish line for its first release, and then for one reason or another it took too much effort to add some very nice features, the cascade itself must have been a beast for Designers that architects and browser developers could implement.

0
source share

All Articles