+ 2
[CSS]🎨 Question: Relative and Fixed position?
I was working on a code in web. Meanwhile I used position attribute and discovered that there are two types of value for position viz. fixed and relative (Absolute is also) I want to know what is exactly the difference between both of them, relative and fixed positioning? Thank you!
2 ответов
+ 8
Relative property of positioning is used for some content we don't want to determines its top, bottom, left and right. It will be fixed to nearest parent element. Whereas, In fixed property of positioning it is been nearest to the viewport where it is fixed. Even on the scrolling of the page it will not move from it's place.
+ 5
Check the difference with example.
https://www.w3schools.com/css/css_positioning.asp