Reputation: 573
<div id="menu">
<ul><li><a href="#" class="current">SocialSpot</a></li>
<li><a href="#">Profile</a></li>
<li><a href="#">Latest</a></li>
<li><a href="#">Settings</a></li>
<li>Logout</li>
</div>
</ul>
I have this in a webpage. I have css aligning them. However I want the logout button to be aligned to the right but on the same bar. How can I do this without having them all aligned to the right?
Upvotes: 8
Views: 34363
Reputation: 185963
CSS:
ul { overflow:auto; }
li { float:left; }
li:last-child { float:right; }
Live demo: http://jsfiddle.net/simevidas/Rs4Sa/
Btw the :last-child
pseudo-class does not work in IE8 (and below). If you want it to work in those browsers, you will have to assign a class (e.g. right
) to the Logout LI item, and then:
li.right { float:right; }
Live demo: http://jsfiddle.net/simevidas/Rs4Sa/1/
Upvotes: 10
Reputation: 648
Like this? http://jsfiddle.net/QAjkP/
You can use an id tag to specify the css properties for that one <li>
item
Upvotes: 0