Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

right position an element that has already been left positioned

Tags:

html

css

I have css class which sets a span to a particular left position.

left: 0.5em;

How do I override that left value to:

right: 0.5em;

...either inline or in another class?

in other words, how do you set the left value to nothing or null?

like image 853
Chris Simpson Avatar asked Feb 14 '11 23:02

Chris Simpson


People also ask

How do you position an element to the right?

If position: absolute; or position: fixed; - the right property sets the right edge of an element to a unit to the right of the right edge of its nearest positioned ancestor. If position: relative; - the right property sets the right edge of an element to a unit to the left/right of its normal position.

How do you position an element to the left?

The left property affects the horizontal position of a positioned element. This property has no effect on non-positioned elements. If position: absolute; or position: fixed; - the left property sets the left edge of an element to a unit to the left of the left edge of its nearest positioned ancestor.

How do you position an element relative to another?

position: absolute will position the element by coordinates, relative to the closest positioned ancestor, i.e. the closest parent which isn't position: static . Have your four divs nested inside the target div, give the target div position: relative , and use position: absolute on the others.


1 Answers

Perhaps the answer is left: auto?

Live Demo

like image 170
thirtydot Avatar answered Oct 12 '22 20:10

thirtydot