CSS
How it works
An author writes CSS rules made of a selector (which targets elements) and a declaration block — property:value pairs, e.g. color: red; margin: 8px. The browser parses HTML into a document tree (DOM) and matches the applicable rules to each node. When several rules target the same element, the cascade decides the winner: the stylesheet's origin and importance, the selector's specificity and source order. Some properties are inherited by descendant elements. The engine then computes each element's geometry using the box model (content, padding, border, margin) and lays them out using layout modes (normal flow, floats, positioning, flexbox, grid). Media queries apply different rules depending on screen width or medium, enabling responsive design. Because CSS is text, it can be generated programmatically or by a language model.
Problem solved
Early HTML mixed content with appearance (presentational tags like <font>), so every styling change meant editing documents and a consistent look across many pages was hard to maintain. CSS solves this by moving presentation into separate rules: one stylesheet can style many documents, the look can be changed in a single place, and the HTML structure stays clean and semantic. For AI systems this means a declarative, text-based language of appearance that a model can generate directly alongside HTML.
Strengths & limitations
Components
Patterns that target the document elements a rule should apply to (e.g. .class, #id, element, attribute selectors and pseudo-classes).
Property:value pairs (e.g. color: red) grouped into blocks attached to selectors.
The set of rules that decides which declaration wins when several rules target the same element, and how values are inherited.
Describes each element's size and spacing as nested layers: content, padding, border and margin.
Mechanisms for arranging elements: normal flow, floats, positioning and modern flexbox and grid.
Official
Conditional application of rules based on media features such as viewport width, enabling responsive design.
Official
Implementation
In large stylesheets rules override one another in hard-to-predict ways; overusing !important and high-specificity selectors makes it worse.
New CSS features ship at different times and to different extents, causing rendering differences.
Default width calculation and margin collapsing produce surprising spacing and sizes.
Evolution
The proposal for cascading style sheets originated at CERN; Bert Bos is a co-creator of the language.
The first official W3C Recommendation defining CSS.
Extends CSS with positioning, media types and more.
Instead of one specification, CSS evolves as independent modules with their own levels.
A refined, corrected version of CSS2 that served as the baseline for browser implementations.
Modern layout modules become widely available, changing how page layouts are built.
Hardware requirements
CSS is a text-based stylesheet language independent of hardware; it is interpreted and rendered by browser engines on any platform.