What kind of language is CSS?

I would say it is a domain-specific declarative language.


Syntactically, CSS is a mix of two languages: the language of selectors, which is a pattern-matching one, like regexps or xpath, and the language of properties, which can be classified as "procedural-declarative", because properties are essentially assignment operators. At a subjective level, css clearly qualifies as ugly mess, like pretty much every other fruit of collective efforts on the field of language design ("a camel is a horse designed by committee").


CSS is not really a language, per se; it is more of a syntax for describing configuration directives.

In fact, it is neither of these things; CSS is a description of a number of tokens and their visual meanings; .css files contain these tokens structured in manner allowing a computer to parse them. CSS declarations can take the form of name="value" declarations in SVG documents; and the .css file structure could just as easily be employed to, say, contain unit descriptions in a particularly absurd iteration of FreeCiv.

Wikipedias definition of it as a Style sheet language seems like a bit of a forced definition of a generalization of a singularly existing phenomenon; and it should be clear that it is not in any way a markup language, as it doesn't actually, by itself, mark anything up.

Tags:

Css

Definition