I have an anchor with a data-avatar url that points to an image and I want to add a block image to a.avatar::before to show the image.
a[data-avatar]::before {
content: "";
background: url( attr(data-avatar url) ) no-repeat 0 0;
width: 16px;
height: 16px;
display: block;
margin: 0 5px 0 0;
}
<a href="/username" data-avatar="http://some-url.com/image.png">my profile</a>
I cannot set the background image with url(attr(data-avatar))
Here is a fiddle if anyone wants to take a stab -- I am only interested in CSS-only way of doing this without extraneous markup.