Can you style a noscript element?

nickf picture nickf · Mar 24, 2009 · Viewed 10.8k times · Source

Is it possible to use the noscript element in CSS selectors?

noscript p {
    font-weight: bold;
}

Answer

Rex M picture Rex M · Mar 24, 2009

Yes! You can definitely do that.

In fact, many (all?) browsers support targeting any arbitrary tag using CSS. "Official" tags in the HTML spec only define what a browser should do with them. But CSS is a language that targets any flavor of XML, so you can say foo {font-weight:bold;} and in most browsers, <foo> hello world </foo> will come out bold.

As Darko Z clarifies, IE6/7 do not add arbitrary (non-standard) elements to the DOM automatically from the source; they have to be programmatically added.