Can you apply the ccs rule content to child elements?
css :
a:link:before, a:visited:before{
content: " "attr(href)" ";
}
html :
<a href="/home">Home</a>
Result :
-------------
| /home |
| Home |
-------------
However I would like to do the following:
html :
<a href="/home"><span>home</span></a>
With the previous css the href
value would appear before the span
.
Is it possible to make it appear in the span
?
I've tried this. It's for a sitemap.
No, that's not possible.
To make generated content render inside the span
, you need a:link span:before
.
Unfortunately, in that case, content: " "attr(href)" ";
will no longer work, because the a
element is no longer the subject of the selector - the span
is, and the span
does not have the href
attribute.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With