CSS - (Implementation|Processing Model|Rendering)

> (World Wide) Web - (W3|WWW) > CSS - Cascading Style Sheets - Markup Language (HTML|XML) Skin

1 - About

How user agents may implements CSS.

3 - Steps

A user agent processes a source by going through the following steps:

3.1 - Parsing

Parse the source document and create a document tree.

3.2 - Retrieving all style sheets associated with the target media type

  • Identify the target media type
  • Retrieve all style sheets associated with the document that are specified for the target media type.
Advertising

3.3 - Calculation of the property values

Annotate every element of the document tree by assigning a single value to every property that is applicable to the target media type. Properties are assigned values according to the cascading and inheritance mechanisms.

3.4 - Generation of the formatting structure

From the annotated document tree, generate a formatting structure. Often, the formatting structure closely resembles the document tree, but it may also differ significantly, notably when authors make use of:

The formatting structure:

  • need not be “tree-shaped” at all – the nature of the structure depends on the implementation.
  • may contain more or less information than the document tree.

For instance, if an element in the document tree has a value of 'none' for the display property, that element will generate nothing in the formatting structure. A list element, on the other hand, may generate more information in the formatting structure: the list element's content and list style information (e.g., a bullet image).

Note that the CSS user agent does not alter the document tree during this phase. In particular, content generated due to style sheets is not fed back to the document language processor (e.g., for reparsing).

3.5 - Render the output

Transfer the formatting structure to the target medium. E.g.:

  • print the results,
  • display them on the screen,
  • render them as speech,
  • etc.

Rendering is the process by which user agent, after parsing the markup language (HTML, XML,…) and generating the DOM, apply visual rules to the DOM contents in order to draw on the screen.

Advertising

4 - Documentation / Reference

web/css/implementation.txt · Last modified: 2019/02/09 11:43 by gerardnico