I'm trying to display 2 things in my elements; the class
name and an own created data-size
variable. Seperated with one white space.
I could get this working by doing this:
.element:before {
content: attr(class);
}
.element:after {
content: attr(data-size);
}
But it doesnt seem like a the right way to do it. I have also tried to do this:
.element:before {
content: attr(class data-size);
}
But that didnt work aswell.
Input
HTML
<div class="element" data-size="20"></div>
CSS
.element:before {
content: attr(class data-size);
}
Wanted output
element 20
attr(class)" "attr(data-size)
– Fortier