Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make an item in list align to right using CSS 3

I have a list as follows:

<ul id="menu">
  <li><a href="#">Home</a></li>
  <li><a href="#">Work</a>
      <ul>
           <li><a href="#">CSS Development</a></li>
           <li><a href="#">Graphic Design</a></li>
           <li><a href="#">Development Tools</a></li>
           <li><a href="#">Web Design</a></li>
      </ul>
  </li>
  <li><a href="#">About</a></li>
  <li><a href="#">Contact Us</a></li>
  <li><a href="#">Feedback</a></li>
</ul>

I am attaching an image of so far what I have done.

.

In this menu, I want to align feedback to the right side. How can I do it?

like image 410
user2091061 Avatar asked May 07 '13 17:05

user2091061


People also ask

How do I align a list to the right in CSS?

To make a right-aligned version of the list, only three changes need to occur. First, set the "UL" "text-align" to "right". Second, change the left "background-position" from "0" to "100%" - which makes the image align up with the right edge. And finally change "padding-left" to "padding-right".

How do I align a list in CSS?

Position The List Item Markers. The list-style-position property specifies the position of the list-item markers (bullet points). "list-style-position: outside;" means that the bullet points will be outside the list item. The start of each line of a list item will be aligned vertically.

How do I align one item to another in CSS?

First, wrap the form inside a wrapper div. Then, set the display property on the form to inline-block , which makes it react to the text-align: center property on the parent . wrapper element. Finally, set the text-align property on the form to left so that child inline and inline-block elements don't get centered.


1 Answers

Add this to your CSS content.

li:last-child will select the last li of the menu list.

Demo

#menu > li:last-child
{
    float:right;
}
like image 199
PSL Avatar answered Oct 28 '22 01:10

PSL