html - What is the point of using absolute positioning in CSS? -


this link says

an absolute position element positioned relative first parent element has position other static. if no such element found, containing block <html>

so absolute in fact relative. why not use relative instead? there practical use cases can done using absolute positioning not relative?

so absolute in fact relative.

no, both different, rendering different.

a relative positioned element in document flow whereas absolute positioned element out of document flow.

are there practical use cases can done using absolute positioning not relative?

assume want title on image hover, need position title containing element absolute element holding image has positioned relative. if not assign position: relative; element holding absolute positioned elements, absolute positioned elements flow out in wild.

case

case 2 (if element not positioned relative, absolute positioned elements flow out in wild)

so inshort, can absolute positioned elements not take physical space on document out of flow inorder save them flowing out in wild, use container element positioned relative, relative positioned take space in flow when move absolute positioned elements anywhere on page, won't affect other elements position if move position: relative; element anywhere on page, yes affect other elements - static or relatively positioned around it.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -