Harlequin
Harlequin

Reputation: 389

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.

Upvotes: 0

Views: 628

Answers (3)

user3123529
user3123529

Reputation: 112

Basically you need to remove float: right; and add text-align:right to UL check out eh jsfiddle link i provided to see the solution

//remove 
       li {
        float: right;
        }
   // and add 

    ul {

        text-align:right;
    }

http://jsfiddle.net/jspatel/F3XgY/

Upvotes: 1

CtrlX
CtrlX

Reputation: 7015

You can just add a :

line-height:98px;

to your li class So it will center your text with the ul height

Here is the JSFiddle

Upvotes: 0

CDspace
CDspace

Reputation: 2689

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

Upvotes: 2

Related Questions