CSS Positioning Flashcards
What is the default value for the position property of HTML elements?
<b>Static</b> (which is a <i>value</i> of normal document flow)
How do you constrain an absolutely positioned element to a containing block?
The containing block itself has to have a position of a non-static value (relative, absolute, or fixed)
What are the four box offset properties?
Top, right, bottom, left
How does setting position: relative on an element affect document flow?
It doesn’t.
How does setting position: absolute on an element affect document flow?
Removed from document flow. Other elements will treat it like it no longer exists.
How does setting position: absolute on an element affect where it appears on the page?
It will appear on the first parent that is non-static. If there is none, then it’ll be the viewport. It sits on its own layer separate from the page.
How does setting position: relative on an element affect where it appears on the page?
It doesn’t. It’s self-contained.