Loading…

What are the difference between "position:absolute" & "position:relative" in CSS?

Both Postions(absolute & relative) are having different features. Once we set Position then you can able to use top, right, bottom, left attributes.

An absolute position element is positioned relative to the first parent element that has a position other than static.

Absolute : In case of position absolute, an element searches for the nearest available coordinate axes among its parent elements. The element is then positioned by specifying offsets from this co-ordinates axis. It removed from document normal flow.

Relative : In case of position relative, an element creates its own co-ordinates axes, at a location offset from the view port co-ordinate axis. It is Part of document flow but shifted.

Suggest An Answer

No suggestions avaliable!

Latest post from CSS interview questions

Ask Question