I am trying to show 2 things in my elements; class name and own data-size variable created. Separated by a single space.
I could get this to work by doing the following:
.element:before { content: attr(class); } .element:after { content: attr(data-size); }
But that doesn't seem like the right way to do it. I also tried to do this:
.element:before { content: attr(class data-size); }
But that didn't work either.
Enter
HTML
<div class="element" data-size="20"></div>
CSS
.element:before { content: attr(class data-size); }
Required conclusion
element 20
Demo here
source share