The namespace separator (|
) separates the selector from the namespace, identifying the namespace, or lack thereof, for a type selector.
/* Links in the namespace named myNameSpace */ myNameSpace|a { font-weight: bold; } /* paragraphs in any namespace (including no namespace) */ *|p { color: darkblue; } /* heading level 2 not in a namespace */ |h2 { margin-bottom: 0; }
Type selectors and the universal selector allow an optional namespace component. When a namespace has been previously declared via @namespace
, these selectors can be namespaced by prepending the selector with the name of the namespace separated by the namespace separator (|
). This is useful when dealing with documents containing multiple namespaces such as HTML with inline SVG or MathML, or XML that mixes multiple vocabularies.
-
ns|h1
- matches<h1>
elements in namespacens
-
*|h1
- matches all<h1>
elements -
|h1
- matches all<h1>
elements outside of any declared or implied namespace