The cover of The Complete Idiot's Guide to Create a Web Page The Complete Idiot's Style Sheets Reference

| Index | Current Category: Generated Content |
| Previous Style: color | Next Style: counter-increment |


content

Generates content for a page on-the-fly.

Support:

W3C StandardInternet ExplorerNetscape Navigator
CSS2 and later Not supported Not supported
Notes:
  • This property can only be used within a STYLE block or an external style sheet. You can't use it as an inline style.
  • If you want the generated content to appear before the current element, add :before after the name of the tag (see the example).
  • If you want the generated content to appear after the current element, add :after after the name of the tag.

See Also:

counter-increment, counter-reset, display, quotes

Possible Values:

attr(X)
Inserts a string that represents the value of attribute X for the element.

Support:

W3C StandardInternet ExplorerNetscape Navigator
CSS2 and later Not supported Not supported

Notes:
  • For example, if the element is an <IMG> tag, attr(ALT) inserts the value of the tag's ALT attribute.

close-quote
Adds a closing quotation mark.

Support:

W3C StandardInternet ExplorerNetscape Navigator
CSS2 and later Not supported Not supported

Notes:
  • The type of quotation mark is given by the value of the quotes property.

counter
Adds the current value of the counter with a specified name.

Support:

W3C StandardInternet ExplorerNetscape Navigator
CSS2 and later Not supported Not supported

Notes:
  • There are two syntaxes you can use:

    counter(name)
    counter(name, type)

    Here, name is the name of the counter and type is one of the values defined for the list-style-type property.

counters
Adds the current values of all the counters with a specified name.

Support:

W3C StandardInternet ExplorerNetscape Navigator
CSS2 and later Not supported Not supported

Notes:
  • There are two syntaxes you can use:

    counter(name, string)
    counter(name, string, type)

    Here, name is the name of the counters, string is the string that appears between each counter value, and type is one of the values defined for the list-style-type property.

no-close-quote
A closing quotation is not inserted, but the quotation nesting level is decremented.

Support:

W3C StandardInternet ExplorerNetscape Navigator
CSS2 and later Not supported Not supported

no-open-quote
An opening quotation is not inserted, but the quotation nesting level is incremented.

Support:

W3C StandardInternet ExplorerNetscape Navigator
CSS2 and later Not supported Not supported

open-quote
Adds an opening quotation mark.

Support:

W3C StandardInternet ExplorerNetscape Navigator
CSS2 and later Not supported Not supported

Notes:
  • The type of quotation mark is given by the value of the quotes property.

[string]
Text to add to the page.

Support:

W3C StandardInternet ExplorerNetscape Navigator
CSS2 and later Not supported Not supported

[url]
The file name or full URL of the content.

Support:

W3C StandardInternet ExplorerNetscape Navigator
CSS2 and later Not supported Not supported

Example:
<STYLE TYPE="text/css">
<!--
img:before {content: attr(ALT)}
-->
</STYLE>

| Index | Current Category: Generated Content |
| Previous Style: color | Next Style: counter-increment |