css-positioning Flashcards
What is the default value for the position property of HTML elements?
static
How does setting position: relative on an element affect document flow?
It does not affect the position of surrounding elements; they stay in the position they would be in in normal flow.
How does setting position: relative on an element affect where it appears on the page?
This moves an element from the position it would be in normal flow, shifting it to the top, right, bottom, or left of where it would have been placed.
How does setting position: absolute on an element affect document flow?
The element is removed from the normal document flow, and no space is created for the element in the page layout.
How does setting position: absolute on an element affect where it appears on the page?
It is positioned relative to its closest non-static positioned ancestor, if any; otherwise, it is placed relative to the initial containing block. Its final position is determined by the values of top, right, bottom, and left.
How do you constrain an absolutely positioned element to a containing block?
The containing block must be set to a non-static position.
What are the four box offset properties?
- top
- right
- bottom
- left