How to refer to ROOT element, without using the pseudo class ":root"?
I was trying to refer to the root element w/o using the :r开发者_运维知识库oot . I am trying that for an old version of browser (IE8).
I just can't find anything. How could anyone refer to the root element before CSS3 ??
Thanks in advance.
The root element is always html in HTML and XHTML web documents. So just use
html
{
some style;
}
I am assuming ofcourse that by "refer" you meant "selector" in CSS!
reference
This pseudo-class matches an element that’s the root element of the document. In HTML documents, this selector matches the html element.
For HTML/XHTML documents, as JAA149 says just select the html
element since it's guaranteed to be the root element (even for documents that omit the tags in their markup).
For arbitrary XML documents where the name of the root element may not be known, there is no other way in CSS than with the CSS3 :root
pseudo-class — this is precisely why it was introduced. If you can, use XSL/XSLT instead, with the XPath expression /*
to select the root element.
精彩评论