XML technologies / CSS / Advanced websites with CSS / CSS property reference / quotes

(Excerpt from “CSS − Advanced websites with Cascading Stylesheets” by Rachel Andrew & Dan Shafer)

With the property content and the pseudo-elements :before and :after, CSS can display generated content before or after an HTML element. Generated content can include quotation marks. The property quotes describes the appearance of generated quotation marks.

Because quotation marks may occur inside other quotation marks, it is advisable to define a specific format for each nesting level.

Inherited: yes

See also: content

Values

A space-separated list of quotation mark pairs, or none. If several pairs are specified, the first applies to the initial level, the second to the first nesting level, and so on. The constant none prevents quotation marks from being displayed as generated content.

Default value: browser-dependent

Compatibility

CSS version: 2

Best supported by Opera 7, but with a bug: if quotation marks are specified for n nested levels, all nested quotation marks from level n+1 use the last close-quote character as the open-quote character. In this case, the close-quote character is a double quotation mark.

Mozilla-based browsers (including Netscape 6) support this property, but automatically use the first specified quotation mark at every nesting level.

Internet Explorer 5 for Macintosh supports open-quote and close-quote in the property content, but ignores their settings and chooses the type of quotation marks itself.

Internet Explorer for Windows (through version 6) does not support generated quotation marks.

Example

The following style rule defines double quotation marks for the first level and single quotation marks for the second. This declaration is assigned to body and is therefore inherited by all elements. The quotation marks themselves are inserted for the elements blockquote and q (inline quotation):

body {
 quotes: '"' '"' "'" "'";
}
blockquote: before, q:before {
 content: open-quote;
}
blockquote: after, q:after {
 content: close-quote;
}

  

 

 

 

back to top