Positioning Flashcards
What is the default value for the position property of HTML elements?
position: static
How does position: relative on an element affect document flow?
it doesn’t affect document flow; the element would still be visible
How does setting position: relative on an element affect where it appears on the page?
It appears normally, and when box offsets are adjusted it is positioned away from its normal position (relative to itself)
How does setting position: absolute on an element affect document flow?
It visually changes positions, but it is not visible in the document flow, therefore the page will treat it as if it’s not there and adjusts other elements accordingly.
How does setting position: absolute on an element affect where it appears on the page?
It’s positioned relative to its closest positioned ancestor
How do you constrain an absolutely positioned element to a containing block?
You would have to set its parent (or closest ancestor) to a non-static position (relative, fixed, absolute).
What are the four box offset properties?
right, left, bottom, top