Reputation: 177
I have this:
<div class="likebutton" numberlikes$post="$totallikes">
$post is an id number that php sends.
my problem here is how can CSS understant that I want numberlikes with any number after it, eg: numberlikes63463436 numberlikes548548 ...
my css:
.likebutton:before{
color: #FFFFFF;
content: attr(numberlikes);
background:blue;
padding: 0 10px;
margin-right: 5px;
display: inline-block;
}
how can I tell css that numberlikes will have a random number after it? I try put =^id after numberlikes but it is not working...
content: attr(numberlikes=^id);
thank you!
Upvotes: 0
Views: 74
Reputation: 781706
Don't put $post
in the attribute name, put it in the id
attribute.
.likebutton:before{
color: #FFFFFF;
content: attr(data-numberlikes);
background:blue;
padding: 0 10px;
margin-right: 5px;
display: inline-block;
}
<div class="likebutton" id="likebutton$post" data-numberlikes="$totallikes">
Upvotes: 1