Prev | Current Page 98 | Next

Tommy Olsson and Paul O'Brien

"The Ultimate CSS Reference"

w3.org/1999/xhtml";
@namespace foo "http://example.com/ns/foo";
table {
?‹® declarations
}
foo|bar {
?‹® declarations
}
In the example above, the table selector matches table elements in the XHTML
namespace, while the foo|bar selector matches bar elements in the namespace
referred to by the prefix foo.
Namespaces
The namespace URI is the most important component of a namespace declaration.
Consider this style sheet:
@namespace foo "http://example.com/ns/foo";
foo|bar {
?‹® declarations
}
The foo|bar selector in the above example would match the ??¦
element in this markup fragment because the namespace URI in the markup matches
the namespace URI in the at-rule:

??¦

However, it would not match the ??¦ element in this markup
fragment, since that element??™s in another namespace (that is, the URI doesn??™t match):

??¦

7 It would have been more intuitive to use a colon separator than the vertical bar, but the colon
character is already used for other purposes in selectors??”more about this in Pseudo-classes (p.


Pages:
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110