When an element with position: absolute; is inside a positioned ancestor, to which element will it be positioned relative?

  • To the nearest sibling element.
  • To the parent element.
  • To the top of the document.
  • To the viewport.
When an element with 'position: absolute;' is inside a positioned ancestor, it will be positioned relative to its closest positioned ancestor. If there is none, it will be positioned relative to the viewport (the browser window).
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *