Position: Absolute


#1

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


#2

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


#3

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


#4

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:


#5

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


#6

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


#7

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