+ 2

What is absolute and relative ?

30th Nov 2016, 5:13 AM
Devashish Shrivastava
Devashish Shrivastava - avatar
4 ответов
+ 12
An  element with position: relative;is positioned relative to its normal position. Setting the top, right, bottom, and left properties of a relatively-positioned element will cause it to be adjusted away from its normal position. Other content will not be adjusted to fit into any gap left by the element. An element with position: absolute;is positioned relative to the nearest positioned ancestor (instead of positioned relative to the viewport, like fixed). However; if an absolute positioned element has no positioned ancestors, it uses the document body, and moves along with page scrolling.
30th Nov 2016, 7:15 AM
Remmae - avatar
+ 1
thanks Remmae
1st Dec 2016, 3:36 AM
Devashish Shrivastava
Devashish Shrivastava - avatar
In addition to previous answer, absolute positioned elements doesn't stretch their ancestors. They are out of the normal flow.
30th Nov 2016, 8:20 AM
Alexander Sholk
Alexander Sholk - avatar
- 3
1st Dec 2016, 12:13 AM
Emerson Pozuelos
Emerson Pozuelos - avatar