W3C

Bert Bos | CSS tutorial – XML Namespaces

CSS namespaces for XML

CSS support for XML namespaces

CSS namespaces for XML

Define a name for the namespace:

@namespace x url(http://example.com/ns1);

Use it in a selector:

x|title { color: red }

Useful for certain XML-based formats.

The name is arbitrary, it need not be the same as the prefix in the XML document that you are styling.

Defined names are only valid in the current style sheet, not in any @imported style sheets, nor in any style sheets that @import this one.

The URL must have valid CSS syntax for URLs (which is very lenient). CSS neither dereferences it nor checks if it has a known protocol. It is only used as a literal string to compare against a namespace in an XML file.

Special namespaces