Reputation: 15
I have a problem with the following codes. I want to disable third span
that display posts counter that have been viewed by users. How can i fix it?
span i.mdi.mdi-eye:display:none;
<div class="post-meta">
<span></span>
<span></span>
<span><i class="mdi mdi-eye"></i></span>
</div>
Upvotes: 1
Views: 114
Reputation: 4902
This approach as well works
.post-meta span:last-child() {
display: none;
}
Upvotes: 0
Reputation: 113
.post-meta span:not(empty) {
display: none;
}
<div class="post-meta">
<span></span>
<span></span>
<span><i class="mdi mdi-eye">10</i></span>
</div>
or
.post-meta span:last-child {
display: none;
}
<div class="post-meta">
<span></span>
<span></span>
<span><i class="mdi mdi-eye">10</i></span>
</div>
Upvotes: 1
Reputation: 13222
You can select every third element with the nth-child()
selector. Since you don't have more elements in there it works like intended. Better would be to use the i
class selector though and hide the i
.
div.post-meta :nth-child(3) {
display: none;
}
<div class="post-meta">
<span></span>
<span></span>
<span><i class="mdi mdi-eye">10</i></span>
</div>
Upvotes: 4
Reputation: 167
Your problem is with the css you have. You have not enclosed the styling with curly braces {}
The solution is:
span i.mdi.mid-eye {
display: none;
}
Upvotes: 1