Search code examples
csslistalignment

Aligning items of a list in the right side


I've been searching on how to align items of a list, verticaly, in the right side of a div.

I tried float,

li {
float: right;
}

But it makes the two items be in the right side but not on top of another as I intended.

What I got on Fiddle, as you can see option1 and option2 are in the right side but not vertically aligned.


Solution

  • In your CSS for your li, also add clear:both;. This prevents other objects from being to either side of your li. I tried it in your fiddle, and it works nicely

    See here