content

Supported by Opera and partially by Safari 3.0b Windows.

The content declaration allows you to change the content of an element. Though it's supposed to work only for the :before and :after pseudo-elements, Opera supports it on all elements.

See the :before and :after page for a test on these elements.

Any element

Opera supports content on any element. Setting it to a string is the functional equivalent of setting innerText. HTML code cannot be inserted, the tags show up as '<tag>'.

Testsheet:

p#test {
	content: "Your browser supports content";
}

p#test2 {
	content: url(../pix/logo_quirksmode.gif);
}

Your browser does not support content.

You should see the QuirksMode logo.

Don't use

I feel that we shouldn't use the content declaration at all. It adds content to the page, and CSS is meant for adding presentation to the page, and not content. Therefore I feel that you should use JavaScript if you want to dynamically generate content. CSS is the wrong tool for this job.