Atoms1
Atoms1

Reputation: 15

What is right and left of element in CSS

What is right and left of elements in CSS. When I tried to move element left: 150px . It moves right and vice versa.

Upvotes: 0

Views: 111

Answers (3)

Liftoff
Liftoff

Reputation: 25392

left is the distance from the left edge; right is the distance from the right edge.

For instance, if I set left: 10px, it will move the element 10px away from the left edge of the element.

If you want to move to the left, you can use negative values, e.g. left: -10px.

The same applies to the top and bottom properties.


W3Schools puts it this way:

Sets the left edge of the image [distance] to the right of the left edge of its containing element

Upvotes: 0

user3387318
user3387318

Reputation:

You can use float: left; and float: right; to achieve basic positioning. If you are looking for more advanced positioning could you please post your code so that we can see what you are trying to do! :)

Upvotes: 0

Silverandrew
Silverandrew

Reputation: 96

When you specify a position of element (relative/absolute/fixed/ect) the left and right tags all you to align to and offset: ex. (left:0px;) will align to the left by 0 px or (left:15px;) will align to the left and offset by 15px.. (offset meaning, it pushes from the left 15px out)

Relative positioning you must specify a value- won't take %

absolute position is in relation to it's parents positioning, so you can use % with absolute positioning and left/right:

Upvotes: 1

Related Questions