Position: Absolute

What is the point of adding “position: absolute;” of it will scroll with the page by default anyway?

position: absolute can be very useful to get your element in the right position, for example:

backup link

see what happens when you change position to absolute, quit a difference.

now we can make the example a bit more complicated:

backup link

as you see, position: absolute can be very useful for positioning an element at the right place

edit: jsbin doesn’t seem to output at the moment, backup links included

1 Like

So basically it just moves the square to the right? Can’t you just do that with “position: right;”?

right is not a valid position, right moves the element to the right but it only works with position absolute, this shows one of the advantage of using absolute, you can read more about absolute here:

1 Like

then can’t you just use float: right instead of absolute?

its possible, but elements interact with each other, so knowing multiply ways is better

besides, in the example i also used bottom: 0, this can’t be done with float

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.