We have a client that would like us to use CSS3 namespaces. However, everything I’m finding indicates that it is specifically used for styling XML and not HTML. Can anyone validate using it for CSS/HTML or clarify how you would do this? What are the negatives of following this method?
@namespace toto "http://toto.example.org";
toto|Product {
display:block;
}
toto|Code {
color: black
}
http://www.w3.org/TR/css3-namespace/
http://onwebdev.blogspot.com/2010/04/css3-namespace-selectors.html
Major browsers use a default namespace of
http://www.w3.org/1999/xhtmlwhich is XHTML’s namespace, even for HTML, and go about their business. Technically though, since HTML isn’t XML, there isn’t a point to this unless you consider that XML-based languages like SVG and MathML can be embedded within HTML anyway.If your client wants to make use of CSS namespaces, they’ll probably need to provide you with something that’s written in a language that has some sort of namespacing mechanism that is compatible with CSS. It is meaningless to try and apply this knowledge to HTML itself because
More information can be found in this answer.
To answer your question title, the document language does not necessarily have to be XML-based:
The CSS Namespaces spec borrows terminology from XML Namespaces as a convenience simply because CSS is most commonly applied to HTML and XML documents (and even then, more people use XSL(T) with the latter instead).