CSS Generated Content Module Level 3

Editor’s Draft, 5 December 2014

This version:
http://dev.w3.org/csswg/css-content/
Latest version:
http://www.w3.org/TR/css3-content/
Previous Versions:
http://www.w3.org/TR/2003/WD-css3-content-20030514/
Feedback:
www-style@w3.org with subject line “[css-content] … message topic …” (archives)
Issue Tracking:
Inline In Spec
Editors:
Fantasai (W3C Invited Expert)
(Hachette Livre)
Former Editors:
(Opera Software)
(Google)
Not Ready For Implementation

This spec is not yet ready for implementation. It exists in this repository to record the ideas and promote discussion.

Before attempting to implement this spec, please contact the CSSWG at www-style@w3.org.


Abstract

This CSS3 Module describes how to insert content in a document.

CSS is a language for describing the rendering of structured documents (such as HTML and XML) on screen, on paper, in speech, etc.

Status of this document

This is a public copy of the editors’ draft. It is provided for discussion only and may change at any moment. Its publication here does not imply endorsement of its contents by W3C. Don’t cite this document other than as work in progress.

The (archived) public mailing list www-style@w3.org (see instructions) is preferred for discussion of this specification. When sending e-mail, please put the text “css-content” in the subject, preferably like this: “[css-content] …summary of comment…

This document was produced by the CSS Working Group (part of the Style Activity).

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

This document is governed by the 1 August 2014 W3C Process Document.

Table of Contents

Introduction

Authors sometimes want user agents to render content that does not come from the document tree. One familiar example of this is numbered headings; the author does not want to mark the numbers up explicitly, she or he wants the user agent to generate them automatically. Counters and markers are used to achieve these effects.

h1::before { content: counter(section) ": "; }

Similarly, authors may want the user agent to insert the word "Figure" before the caption of a figure, or "Chapter 7" on a line before the seventh chapter title.

chapter { counter-increment: chapter; }
chapter > title::before { content: "Chapter " counter(chapter) "\A"; }

Another common effect is replacing elements with images or other multimedia content. Since not all user agents support all multimedia formats, fallbacks may have to be provided.

/* Replace <logo> elements with the site’s logo, using a format
 * supported by the UA */
logo { content: url(logo.mov), url(logo.mng), url(logo.png), none; }

/* Replace <figure> elements with the referenced document, or,
 * failing that, with either the contents of the alt attribute or the
 * contents of the element itself if there is no alt attribute */
figure[alt] { content: attr(href, url), attr(alt); }
figure:not([alt]) { content: attr(href, url), contents; }

1. Pseudo-elements (moved)

Now described in [CSS-PSEUDO-4]

2. Inserting and replacing content with the content property

Name:content
Value:[ [ <uri> ] ',' ]* [ normal | none | inhibit | <content-list> ]
Initial:normal
Applies to:elements, pseudo-elements, and page margin boxes.
Inherited:no
Percentages:n/a
Media:all
Computed value:As specified below.
Animatable:no

We should be clear about which pseudo-elements can use the content property.

The content property dictates what is rendered inside the element or pseudo-element. It takes a comma separated list of URIs, followed by a space separated list of tokens. If there are multiple URIs provided, then each is tried in turn until a value which is both available and supported is found. The last value is used as a fallback if the others fail.

<uri>;

For URIs other than URIs in the last comma separated section of the value, if the URI is available and the format is supported, then the element or pseudo-element becomes a replaced element, otherwise, the next item in the comma separated list is used, if any.

h1 { content: url(header/mng), url(header/png), none; }

In the example above, if header/mng wasn’t in a supported format, then header/png would have been used instead. In the example above, if header/png wasn’t available either, then the <h1> element would be empty, as the last alternative is none.

To make an element fallback on its contents, you have to explicitly give contents as a fallback:

content: url(1), url(2), url(3), contents;

What happens when no formats are supported, and the author does not explicitly indicate a fallback?

Why doesn’t an element fallback to contents unless an author explicitly says so?

If the URI is part of the last comma separated value in the list, as the second URI in the following example:

h1 { content: url(welcome), "Welcome to: " url(logo); }

...then if the file is available and the format is supported, then an anonymous replaced inline element is inserted, otherwise the image is ignored (as if it hadn’t been given at all).

There appears to be some change from [CSS21] which says, "If the user agent cannot display the resource it must either leave it out as if it were not specified or display some indication that the resource cannot be displayed." Are we now saying that a user agent cannot display a missing image graphic in this situation?

When a URI is used as replaced content, it affects the generation of ::before and ::after pseudo-elements.

normal

For an element, this computes to contents.

For ::before and ::after, this computes to inhibit.

none

On elements, this inhibits the children of the element from being rendered as children of this element, as if the element was empty.

On pseudo-elements it causes the pseudo-element to have no content.

In neither case does it prevent any pseudo-elements which have this element or pseudo-element as a superior from being generated.

inhibit

On elements, this inhibits the children of the element from being rendered as children of this element, as if the element was empty.

On pseudo-elements, this inhibits the creation of the pseudo-element, as if display computed to none.

In both cases, this further inhibits the creation of any pseudo-elements which have this pseudo-element as a superior.

Is inhibit still necessary, in the absence of multiple pseudo-elements?

<content-list>

[ <string> | contents | attr(<identifier>) | <uri> | counter() | counters() | string() | open-quote | close-quote | no-open-quote | no-close-quote | date() | time() | document-url | target-counter() | target-counters() | target-text() | leader() ]+

One or more of the following values, concatenated.

<string>

The element or pseudo-element contains the specified string. Occurrences of line-feed or space characters in the string are handled according to the properties given in the [CSS3TEXT] module.

If the value is the empty string, and the element or pseudo-element’s display property computes to anything but inline, then the element or pseude-element contains an empty anonymous inline box, otherwise the element contains an empty string.

(This is a formal way of saying that an empty string is different from none in that it forces the creation of a line box, even if the line box would be empty.)

contents

The element’s descendents. Since this can only be used once per element (you can’t duplicate the children if, e.g., one is a plugin or form control), it is handled as follows:

Note that the Prince PDF Formatter does allow the contents of an element to also be used in a pseudo-element.

If set on the element:

Always honoured. Note that this is the default, since the initial value of content is normal and normal computes to contents on an element.

If set on one of the element’s other pseudo-elements:

Check to see that it is not set on a "previous" pseudo-element, in the following order, depth first:

  1. the element itself

  2. ::before

  3. ::after

If it is already used, then it evaluates to nothing (like none). Only pseudo-elements that are actually generated are checked.

In the following case:

foo { content: normal; }   /* this is the initial value */foo::after { content: contents; }

...the element’s content property would compute to contents and the after pseudo element would have no contents (equivalent to none) and thus would not appear.

foo { content: none; }foo::after { content: contents; }

But in this example, the ::after pseudo-element will contain the contents of the foo element.

Use cases for suppressing the content on the element and using it in a pseudo-element would be welcome.

Note that while it is useless to include contents twice in a single content property, that is not a parse error. The second occurrence simply has no effect, as it has already been used. It is also not a parse error to use it on a marker pseudo-element, it is only during the rendering stage that it gets treated like none.

'counter()' and 'counters()'

Inserts the values of 'counter()' and/or 'counters()' functions. See [CSS3LIST] for more information.

'string()'

Inserts the value of a named string. See the section on named strings for more information.

open-quote and close-quote

These values are replaced by the appropriate string from the quotes property. See the section on quotes for more information.

no-open-quote and no-close-quote

Inserts nothing (as in none), but increments (decrements) the level of nesting for quotes. See the section on quotes for more information.

<datetime>

Dates and times can be specified with two functions, 'date()' and 'time()'. See the section on dates and times for more information.

There is no section on dates and times yet.

document-url

The URI of the current document. For local files, this may simply be the local file name.

'target-counter()', 'target-counters()', and 'target-text()'

See the section on cross-references for more information.

'leader()'

Inserts a leader. See the section on leaders for more information.

2.1. Alternative text for Generated Content: The alt property

The generated content of a ::before or ::after element is not always appropriate for assistive technology. In these cases, alternative text can be provided using the alt property. The alt property applies only to the same elements the content property applies to.

Name:alt
Value:none | <string>
Initial:none
Applies to:::before and ::after pseudo-elements
Inherited:no
Percentages:n/a
Media:visual
Computed value:as specified
Animatable:no
none
No alternative text
<string>
The alternative text is the <string>. This can be the empty string.

When the alt property computes to anything other than none, the alternative <string> should be used instead of the value of the contents property by assistive technology.

Here the content property is an image, so the alt property is required to provide alternative text.

.new::before { 
  content: url(./img/star.png);
  alt: "New!"; 
}

If the pseudo-element is purely decorative and its function is covered elsewhere, setting alt to the empty string can avoid reading out the decorative element. Here the ARIA attribute will be spoken as "collapsed". Without the empty string alt value, the content would also be spoken as "Black right-pointing pointer".

.expandable::before {
  content: "\25BA"; /* a.k.a. ► */
  alt: ""; 
  /* aria-expanded="false" already in DOM, 
     so this pseudo-element is decorative */
}

3. Replaced content

If the computed value of the part of the content property that ends up being used is a single URI, then the element or pseudo-element is a replaced element. The box model defines different rules for the layout of replaced elements than normal elements. Replaced elements do not have '::before' and '::after' pseudo-elements; the content property in the case of replaced content replaces the entire contents of the element’s box.

4. Specifying quotes with the quotes property

HTML has long had the q element, used to delimit quotations. The quotes property, in conjunction with the various quote values of the content property, can be used to properly style such quotations.

Name:quotes
Value:[ <string> <string> ]+ | none
Initial:depends on user agent
Applies to:all elements
Inherited:yes
Percentages:n/a
Media:all
Computed value:specified value
Animatable:no

The previous ED had an initial value of text, which was an error. [CSS21] has initial value of "depends on user agent". Do we use auto for things like this, or is it just a UA stylesheet issue?

This property specifies quotation marks for any number of embedded quotations. Values have the following meanings:

none
The open-quote and close-quote values of the content property produce no quotations marks, as if they were no-open-quote and no-close-quote respectively.
[ <string> <string> ]+
Values for the open-quote and close-quote values of the content property are taken from this list of pairs of quotation marks (opening and closing). The first (leftmost) pair represents the outermost level of quotation, the second pair the first level of embedding, etc. The user agent must apply the appropriate pair of quotation marks according to the level of embedding.

For example, applying the following style sheet:

/* Specify pairs of quotes for two levels in two languages */
:lang(en) > q { quotes: '"' '"' "'" "'" }
:lang(no) > q { quotes: "«" "»" "’" "’" }

/* Insert quotes before and after Q element content */
q::before { content: open-quote }
q::after  { content: close-quote }

to the following HTML fragment:

<html lang="en">
  <head>
    <title>Quotes</title>
  </head>
  <body>
    <p><q>Quote me!</q></p>
  </body>
</html>

would allow a user agent to produce:

"Quote me!"

while this HTML fragment:

<html lang="no">
  <head>
    <title>Quotes</title>
  </head>
  <body>
    <p><q>Trøndere gråter når <q>Vinsjan på kaia</q> blir deklamert.</q></p>
  </body>
</html>

would produce:

«Trøndere gråter når ’Vinsjan på kaia’ blir deklamert.»

4.1. Inserting quotes with the content property

Quotation marks are inserted in appropriate places in a document with the open-quote and close-quote values of the content property. Each occurrence of open-quote or close-quote is replaced by one of the strings from the value of quotes, based on the depth of nesting.

Open-quote refers to the first of a pair of quotes, close-quote refers to the second. Which pair of quotes is used depends on the nesting level of quotes: the number of occurrences of open-quote in all generated text before the current occurrence, minus the number of occurrences of close-quote. If the depth is 0, the first pair is used, if the depth is 1, the second pair is used, etc. If the depth is greater than the number of pairs, the last pair is repeated.

Note that this quoting depth is independent of the nesting of the source document or the formatting structure.

Some typographic styles require open quotation marks to be repeated before every paragraph of a quote spanning several paragraphs, but only the last paragraph ends with a closing quotation mark. In CSS, this can be achieved by inserting "phantom" closing quotes. The keyword no-close-quote decrements the quoting level, but does not insert a quotation mark.

The following style sheet puts opening quotation marks on every paragraph in a blockquote, and inserts a single closing quote at the end:

blockquote p:before { content: open-quote }
blockquote p:after { content: no-close-quote }
blockquote p:last-child::after { content: close-quote }

For symmetry, there is also a no-open-quote keyword, which inserts nothing, but increments the quotation depth by one.

If a quotation is in a different language than the surrounding text, it is customary to quote the text with the quote marks of the language of the surrounding text, not the language of the quotation itself.

For example, French inside English:

The device of the order of the garter is “Honi soit qui mal y pense.”

English inside French:

Il disait: « Il faut mettre l’action en ‹ fast forward ›. »

A style sheet like the following will set the quotes property so that open-quote and close-quote will work correctly on all elements. These rules are for documents that contain only English, French, or both. One rule is needed for every additional language. Note the use of the child combinator (">") to set quotes on elements based on the language of the surrounding text:

:lang(fr) > * { quotes: "\00AB\2005" "\2005\00BB" "\2039\2005" "\2005\203A" }
:lang(en) > * { quotes: "\201C" "\201D" "\2018" "\2019" }

The quotation marks are shown here in a form that most people will be able to type. If you can type them directly, they will look like this:

:lang(fr) > * { quotes: "« " " »" "‹ " " ›" }
:lang(en) > * { quotes: "“" "”" "‘" "’" }

5. Automatic counters and numbering: the counter-increment and counter-reset properties (moved)

Now described in [CSS3LIST]

6. Named strings

CSS3 introduces 'named strings', which are the textual equivalent of counters and which have a distinct namespace from counters. Named strings follow the same nesting rules as counters. The string-set property accepts values similar to the content property, including the extraction of the current value of counters.

Named strings are a convenient way to pull metadata out of the document for insertion into headers and footers. In HTML, for example, META elements contained in the document HEAD can set the value of named strings. In conjunction with attribute selectors, this can be a powerful mechanism:

meta[author] { string-set: author attr(author); }
head > title { string-set: title contents; }
@page:left {
  @top {
    text-align: left;
    vertical-align: middle;
    content: string(title);
  }
}
@page:right {
  @top {
    text-align: right;
    vertical-align: middle;
    content: string(author);
  }
}

The string-set property copies the text content of an element into a named string, which functions as a variable. The text content of this named string can be retrieved using the string() function. Since these variables may change on a given page, an optional second value for the string() function allows authors to choose which value on a page is used.

6.1. The string-set property

Name:string-set
Value:[[ <custom-ident> <content-list>] [, <custom-ident> <content-list>]* ] | none
Initial:none
Applies to:all elements, but not pseudo-elements
Inherited:no
Percentages:N/A
Media:all
Computed value:specified value
Animatable:no

The string-set property contains one or more pairs, each consisting of an custom identifier (the name of the named string) followed by a content-list describing how to construct the value of the named string.

content-list expands to one or more of the following values, in any order.

content-list = [ <string> | <counter()> | <counters()> | <content()> | attr(<identifier>) ]+
<string>
A string, as defined in [CSS21]
<counter()>
A counter() function, as described in [CSS21].
<counters()>
A counters() function, as described in [CSS21].
content()
The content() function, described below.
attr(<identifier>)
Returns the string value of the attribute <identifier>, as defined in [CSS3VAL]

6.1.1. The content() function

content() = content([text | before | after | first-letter ])

How do we define the default value for this function?

text
The string value of the element, determined as if white-space: normal had been set. This is the default value
before
The string value of the ::before pseudo-element, determined as if white-space: normal had been set.
after
The string value of the ::after pseudo-element, determined as if white-space: normal had been set.
first-letter
The first letter of the element, as defined for the ::first-letter pseudo-element

The content values of named strings are assigned at the point when the content box of the element is first created (or would have been created if the element’s display value is none). The entry value for a page is the assignment in effect at the end of the previous page. The exit value for a page is the assignment in effect at the end of the current page.

Whenever the value of the element changes, the value of the named string(s) is updated. User agents must be able to recall many values of the named string, as the string() function can return past, current, or future values of the assignment.

HTML:

<h1>Loomings</h1>

CSS:

h1::before { content: 'Chapter ' counter(chapter); }
h1 { string-set: header content(before) ':' content(text); }
h1::after { content: '.'; }

The value of the named string “header” will be “Chapter 1: Loomings”.

HTML:
<section title="Loomings">

CSS:

section { string-set: header attr(title) }

The value of the “header” string will be “Loomings”.

6.2. The string() function

The string() function is used to copy the value of a named string to the document, via the content property. This function requires one argument, the name of the named string. Since the value of a named string may change several times on a page (as new instances of the element defining the string appear) an optional second argument indicates which value of the named string should be used.

string() = string( <custom-ident> [ , [ first | start | last | first-except] ]? )

The second argument of the string() function is one of the following keywords:

first
The value of the first assignment on the page is used. If there is no assignment on the page, the entry value is used. first is the default value.
start
If the element is the first element on the page, the value of the first assignment is used. Otherwise the entry value is used. The entry value may be empty if the element hasn’t yet appeared.
last
The exit value of the named string is used.
first-except
This is identical to first, except that the empty string is used on the page where the value is assigned.
CSS:
@page {
   size: 15cm 10cm;
   margin: 1.5cm;
   
   @top-left {
   content: "first: " string(heading, first); 
   }
   @top-center {
   content: "start: " string(heading, start); 
   }
    @top-right {
    content: "last: " string(heading, last); 
   }
  }
  
h2 { string-set: heading content() }

The following figures show the first, start, and last assignments of the “heading” string on various pages.

The start value is empty, as the string had not yet been set at the start of the page.
Since the page starts with an h2, the start value is the value of that head.
Since there’s not an h2 at the top of this page, the start value is the exit value of the previous page.

The following example captures the contents of H1 elements, which represent chapter names in this hypothetical document.

H1 { string-set: chapter contents; }

When an H1 element is encountered, the chapter string is set to the element’s textual contents, and the previous value of chapter, if any, is overwritten.

6.3. '@counter-styles'

Replaced by [CSS-COUNTER-STYLES-3]

7. Leaders

A leader, sometimes known as a tab leader or a dot leader, is a repeating pattern used to visually connect content across horizontal spaces. They are most commonly used in tables of contents, between titles and page numbers. The leader() function, as a value for the content property, is used to create leaders in CSS. This function takes a string (the leader string), which describes the repeating pattern for the leader.
Name:content
New values:leader()
Media:paged
leader() = leader( [dotted | solid | space] | <string>);

Three keywords are shorthand values for common strings:

dotted
leader(". ")
solid
leader("_")
space
leader(" ")
<string>
ol.toc a::after {
  content: leader('.') target-counter(attr(href), page);
}

<h1>Table of Contents</h1>
<ol class="toc">
<li><a href="#chapter1">Loomings</a></li>
<li><a href="#chapter2">The Carpet-Bag</a></li>
<li><a href="#chapter3">The Spouter-Inn</a></li>
</ol>

This might result in:
Table of Contents

1. Loomings.....................1
2. The Carpet-Bag...............9
3. The Spouter-Inn.............13

Do leaders depend on the assumption that the content after the leader is right-aligned (end-aligned)?

7.1. Rendering leaders

Consider a line which contains the content before the leader (the “before content”), the leader, and the content after the leader (the “after content”). Leaders obey the following rules:
  1. The leader string must appear in full at least once.
  2. The leader should be as long as possible
  3. Visible characters in leaders should vertically align with each other when possible.
  4. Line break characters in the leader string must be ignored.
  5. White space in the leader string follows normal CSS rules.
  6. A leader only appears between the start content and the end content.
  7. A leader only appears on a single line, even if the before content and after content are on different lines.
  8. A leader can’t be the only thing on a line.

7.1.1. Procedure for rendering leaders

  1. Lay out the before content, until reaching the line where the before content ends.
    BBBBBBBBBB
    BBB
    
  2. The leader string consists of one or more glyphs, and is thus an inline box. A leader is a row of these boxes, drawn from the end edge to the start edge, where only those boxes not overlaid by the before or after content. On this line, draw the leader string, starting from the end edge, repeating as many times as possible until reaching the start edge.
    BBBBBBBBBB
    ..........
    
  3. Draw the before and after content on top of the leader. If any part of the before or after content overlaps a glyph in a leader string box, that glyph is not displayed.
    BBBBBBBBBB
    BBB....AAA
    
  4. If one full copy of the leader string is not visible:
    BBBBBBB
    BBBBBBA
    
    Insert a line break before the after content, draw the leader on the next line, and draw the end content on top
    BBBBBBB
    BBBBBB
    ......A
    
drawing leaders
Procedure for drawing leaders
drawing leaders
Procedure for drawing leaders when the content doesn’t fit on a single line

8. Cross-references

Many documents contain internal references: Three new values for the content property are used to automatically create these types of cross-references: target-counter(), target-counters(), and target-text(). Each of these displays information obtained from the target end of a link.

8.1. The target-counter() function

The target-counter() function retrieves the value of the innermost counter with a given name. The required arguments are the url of the target and the name of the counter. An optional counter-style argument can be used to format the result.

These functions only take a fragment URL which points to a location in the current document. If there’s no fragment, if the ID referenced isn’t there, or if the URL points to an outside document, the user agent must treat that as an error.

target-counter() = target-counter( <url> , <custom-ident> [ , <counter-style> ]? )
HTML:
…which will be discussed on page <a href="#chapter4_sec2"></a>.

CSS:

a::after { content: target-counter(attr(href url), page) }

Result:

…which will be discussed on page 137.
Page numbers in tables of contents can be generated automatically:

HTML:

<nav>
  <ol>
    <li class="frontmatter"><a href="#pref_01">Preface</a></li>
    <li class="frontmatter"><a href="#intr_01">Introduction</a></li>
    <li class="bodymatter"><a href="#chap_01">Chapter One</a></li>
  </ol>
</nav>

CSS:

.frontmatter a::after { content: leader('.') target-counter(attr(href url), page, lower-roman) }
.bodymatter a::after { content: leader('.') target-counter(attr(href url), page, decimal) }

Result:

Preface.............vii
Introduction.........xi
Chapter One...........1

8.2. The target-counters() function

This functions fetches the value of all counters of a given name from the end of a link, and formats them by inserting a given string between the value of each nested counter.
target-counters() = target-counter( <url> , <custom-ident> , <string> [ , <counter-style> ]? )
I have not found a compelling example for target-counters() yet.

8.3. target-text

The target-text() function retrieves the text value of the element referred to by the URL. An optional second argument specifies what content is retrieved, using the same values as the string-set property above.
target-text() = target-counter( <url> [ , [ content | before | after | first-letter] ]? )

A simpler syntax has been proposed by fantasai: http://lists.w3.org/Archives/Public/www-style/2012Feb/0745.html

…which will be discussed <a href="#chapter_h1_1">later</a>.

a::after { content: ", in the chapter entitled " target-text(attr(href url)) }

Result: …which will be discussed later, in the chapter entitled Loomings.

9. Bookmarks

Some document formats, most notably PDF, allow the use of bookmarks as an aid to navigation. Bookmarks provide a hierarchy of links to document elements, as well as text to label the links. A bookmark has three properties: bookmark-level, bookmark-label, and bookmark-state.

A bookmark references a point in the document, which we define to the be the intersection of the before edge and the start edge of the first box or box fragment generated by the element. When a user activates a bookmark, the user agent must bring that reference point to the user’s attention, by moving to that page, scrolling (as defined in CSSOM View), or some other mechanism.

9.1. bookmark-level

The bookmark-level property determines if a bookmark is created, and at what level. If this property is absent, or has value none, no bookmark should be generated, regardless of the values of bookmark-label or bookmark-state.

Name:bookmark-level
Value:none | <integer>
Initial:none
Applies to:all elements
Inherited:no
Percentages:N/A
Media:visual
Computed value:specified value
Animatable:no
<integer>
defines the level of the bookmark, with the highest level being 1 (negative and zero values are invalid).
none
no bookmark is generated.
section h1 { bookmark-level: 1; }
section section h1 { bookmark-level: 2; }
section section section h1 { bookmark-level: 3; }

9.2. bookmark-label

Name:bookmark-label
Value:<content-list>
Initial:content(text)
Applies to:all elements
Inherited:no
Percentages:N/A
Media:visual
Computed value:specified value
Animatable:no
<content-list>
<content-list> is defined above, in the section on the string-set property. The value of <content-list> becomes the text content of the bookmark label.
HTML:
<h1>Loomings</h1>

CSS:

h1 { 
bookmark-label: content(text);
bookmark-level: 1;
}

The bookmark label will be “Loomings”.

9.3. bookmark-state

Bookmarks typically toggle open and closed, with the open state displaying the next level of bookmarks.
Name:bookmark-state
Value:open | closed
Initial:open
Applies to:block-level elements
Inherited:no
Percentages:N/A
Media:visual
Computed value:specified value
Animatable:no
open
The bookmarks of the nearest descendants of an element with a bookmark-state of open will be displayed.
closed
any bookmarks of descendant elements are not initially displayed.

10. Changes since the 14 May 2003 Working Draft

Acknowledgments

Stuart Ballard, David Baron, Bert Bos, and Tantek Çelik provided invaluable suggestions used in this specification.

Conformance

Document conventions

Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification.

All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. [RFC2119]

Examples in this specification are introduced with the words "for example" or are set apart from the normative text with class="example", like this:

This is an example of an informative example.

Informative notes begin with the word "Note" and are set apart from the normative text with class="note", like this:

Note, this is an informative note.

Advisements are normative sections styled to evoke special attention and are set apart from other normative text with <strong class="advisement">, like this: UAs MUST provide an accessible alternative.

Conformance classes

Conformance to this specification is defined for three conformance classes:

style sheet
A CSS style sheet.
renderer
A UA that interprets the semantics of a style sheet and renders documents that use them.
authoring tool
A UA that writes a style sheet.

A style sheet is conformant to this specification if all of its statements that use syntax defined in this module are valid according to the generic CSS grammar and the individual grammars of each feature defined in this module.

A renderer is conformant to this specification if, in addition to interpreting the style sheet as defined by the appropriate specifications, it supports all the features defined by this specification by parsing them correctly and rendering the document accordingly. However, the inability of a UA to correctly render a document due to limitations of the device does not make the UA non-conformant. (For example, a UA is not required to render color on a monochrome monitor.)

An authoring tool is conformant to this specification if it writes style sheets that are syntactically correct according to the generic CSS grammar and the individual grammars of each feature in this module, and meet all other conformance requirements of style sheets as described in this module.

Partial implementations

So that authors can exploit the forward-compatible parsing rules to assign fallback values, CSS renderers must treat as invalid (and ignore as appropriate) any at-rules, properties, property values, keywords, and other syntactic constructs for which they have no usable level of support. In particular, user agents must not selectively ignore unsupported component values and honor supported values in a single multi-value property declaration: if any value is considered invalid (as unsupported values must be), CSS requires that the entire declaration be ignored.

Experimental implementations

To avoid clashes with future CSS features, the CSS2.1 specification reserves a prefixed syntax for proprietary and experimental extensions to CSS.

Prior to a specification reaching the Candidate Recommendation stage in the W3C process, all implementations of a CSS feature are considered experimental. The CSS Working Group recommends that implementations use a vendor-prefixed syntax for such features, including those in W3C Working Drafts. This avoids incompatibilities with future changes in the draft.

Non-experimental implementations

Once a specification reaches the Candidate Recommendation stage, non-experimental implementations are possible, and implementors should release an unprefixed implementation of any CR-level feature they can demonstrate to be correctly implemented according to spec.

To establish and maintain the interoperability of CSS across implementations, the CSS Working Group requests that non-experimental CSS renderers submit an implementation report (and, if necessary, the testcases used for that implementation report) to the W3C before releasing an unprefixed implementation of any CSS features. Testcases submitted to W3C are subject to review and correction by the CSS Working Group.

Further information on submitting testcases and implementation reports can be found from on the CSS Working Group’s website at http://www.w3.org/Style/CSS/Test/. Questions should be directed to the public-css-testsuite@w3.org mailing list.

References

Normative References

[rfc2119]
S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://tools.ietf.org/html/rfc2119

Informative References

[CSS21]
Bert Bos; et al. Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification. 7 June 2011. W3C Recommendation. URL: http://www.w3.org/TR/2011/REC-CSS2-20110607
[CSS3GCPM]
Håkon Wium Lie. CSS Generated Content for Paged Media Module. 29 November 2011. W3C Working Draft. (Work in progress.) URL: http://www.w3.org/TR/2011/WD-css3-gcpm-20111129/
[CSS3LIST]
Tab Atkins Jr.. CSS Lists and Counters Module Level 3. 24 May 2011. W3C Working Draft. (Work in progress.) URL: http://www.w3.org/TR/2011/WD-css3-lists-20110524
[CSS3TEXT]
Elika J. Etemad; Koji Ishii. CSS Text Module Level 3. 13 November 2012. W3C Working Draft. (Work in progress.) URL: http://www.w3.org/TR/2012/WD-css3-text-20121113/
[CSS3VAL]
Håkon Wium Lie; Tab Atkins; Elika J. Etemad. CSS Values and Units Module Level 3. 30 July 2013. W3C Candidate Recommendation. (Work in progress.) URL: http://www.w3.org/TR/2013/CR-css3-values-20130730/
[css-counter-styles-3]
Tab Atkins Jr.. CSS Counter Styles Level 3. 26 August 2014. LCWD. URL: http://www.w3.org/TR/css-counter-styles-3/

Index

Property Index

NameValueInitialApplies toInh.%agesMediaAnimatableComputed value
content[ [ <uri> ] ',' ]* [ normal | none | inhibit | <content-list> ]normalelements, pseudo-elements, and page margin boxes.non/aallnoAs specified below.
altnone | <string>none::before and ::after pseudo-elementsnon/avisualnoas specified
quotes[ <string> <string> ]+ | nonedepends on user agentall elementsyesn/aallnospecified value
string-set[[ <custom-ident> <content-list>] [, <custom-ident> <content-list>]* ] | nonenoneall elements, but not pseudo-elementsnoN/Aallnospecified value
bookmark-levelnone | <integer>noneall elementsnoN/Avisualnospecified value
bookmark-label<content-list>content(text)all elementsnoN/Avisualnospecified value
bookmark-stateopen | closedopenblock-level elementsnoN/Avisualnospecified value

Issues Index

Now described in [CSS-PSEUDO-4]
We should be clear about which pseudo-elements can use the content property.
What happens when no formats are supported, and the author does not explicitly indicate a fallback?
Why doesn’t an element fallback to contents unless an author explicitly says so?
There appears to be some change from [CSS21] which says, "If the user agent cannot display the resource it must either leave it out as if it were not specified or display some indication that the resource cannot be displayed." Are we now saying that a user agent cannot display a missing image graphic in this situation?
Is inhibit still necessary, in the absence of multiple pseudo-elements?
Note that the Prince PDF Formatter does allow the contents of an element to also be used in a pseudo-element.
Use cases for suppressing the content on the element and using it in a pseudo-element would be welcome.
There is no section on dates and times yet.
The previous ED had an initial value of text, which was an error. [CSS21] has initial value of "depends on user agent". Do we use auto for things like this, or is it just a UA stylesheet issue?
Now described in [CSS3LIST]
How do we define the default value for this function?
Replaced by [CSS-COUNTER-STYLES-3]
Do leaders depend on the assumption that the content after the leader is right-aligned (end-aligned)?
A simpler syntax has been proposed by fantasai: http://lists.w3.org/Archives/Public/www-style/2012Feb/0745.html