Reputation: 17829
So I would like to use pre
tags in a documentation web page. Now, I want the correct language to be in the top right corner. So This is what I thought I could do:
<pre class="code" language="Python"></pre>
then I could use after
and attr(X)
in CSS to fill the psuedo after with the content of language
:
pre.code:after{
content: attr("language");
position:absolute;
right:0;
top:0;
}
But this is not doing anything!
if I change attr("language")
to "Python"
it works...why does attr(X) not work here?
Upvotes: 2
Views: 2362
Reputation: 240858
Don't include quotations within the attr()
expression.
Use attr(language)
as opposed to attr("language")
.
UPDATED EXAMPLE HERE - your code now works with that minor correction.
pre.code:after {
content: attr(language);
}
See @BoltClock's comments below for details as to why quotations aren't suppose to be used.
Upvotes: 4