Stumbler
Stumbler

Reputation: 2146

Writing html from css

I'm having difficulty in inserting html tags through CSS and for it to be interpreted as html.

I want to write <noscript><h2>Please enable javascript!</h2></noscript> after the h1 header on all pages; so I have

h1:after
{ 
content: "\003cnoscript\003e\003ch2\003ePlease enable javascript! \003c/h2\003e\003c/noscript\003e";
}

in my CSS.

Whilst this successfully writes

<noscript><h2>Please enable javascript!</h2></noscript> 

It is treated as a string literal and displays it on the page as part of the original h1 header.

For obvious reasons I cannot use javascript for this particular task :P

Upvotes: 0

Views: 143

Answers (1)

Pranav 웃
Pranav 웃

Reputation: 8477

From W3 :

Generated content does not alter the document tree. In particular, it is not fed back to the document language processor (e.g., for reparsing).

Content in <noscript> is displayed only when javascript is disabled.

Upvotes: 2

Related Questions