Chapter 23. Lists and Generated Content

One of the advantages to using an ordered list element on a web page is that the browser numbers list each item automatically. This makes it easier to add, delete, or move list items around without manually editing the numbers, because they aren’t in the source document in the first place—they’re generated by the user agent. CSS 2.1 provides a number of properties for controlling the style, content, and position of numbers and bullets (called markers ) used for unordered and ordered lists .

The creators of the CSS 2.1 specification realized there might be other instances in which it would be useful to have user agents generate content that isn’t actually present in the document tree. The generated content features of CSS 2.1 provide a mechanism for inserting any specified text or counters (automatic numbering) before or after any element in an (X)HTML or XML document.

This chapter covers the CSS 2.1 properties related to controlling markers for list items as well as the properties associated with generated content.

    list-style-type         list-style
    list-style-image        display: list-item
    list-style-position     content
    quotes                  counter-reset
    counter-increment

Get Web Design in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.