Reputation: 6030
if this is the html:
<ul>
<li><a href="#">link 1</a></li>
<li><a href="#">link 2</a></li>
<li><a href="#">link 3</a></li>
<li><a href="#">link 4</a></li>
</ul>
and this is the css:
ul li
{
margin-right:5px;
display:block;
float:left;
}
Is there a way to use :last-child so there is no margin-right on the last list item?
I tried
ul li:last-child
{
margin-right:0px;
}
and it didn't work. How would this pseudo-selector be used on a li element?
Upvotes: 1
Views: 922
Reputation: 98826
:last-child
isn’t supported in:
http://www.browsersupport.net/CSS/:last-child
Are you using one of those browsers?
Upvotes: 0
Reputation: 207900
You have an error in your rule. It says ui
but should be ul
. And it should work fine.
Here's a jsFiddle example.
Upvotes: 3
Reputation: 1272
you misspelled your css
You have
ui li:last-child
and it should be
ul li:last-child
And your question is asking about margin-left, but your css is showing us margin-right
Upvotes: 2