positioning and floats Flashcards
position: static;
normal flow of the document –> everything migrates to the upper left hand corner of the page
default –> don’t have to declare it
position: relative;
positions element relative to where it would fall in the normal flow of document by defining “offset values”:
distances from top, bottom, left, or right of that position
scrolls normally –> does not stay on page
position: absolute;
takes offset values (top, bottom, left, right) –> distance from the parent element IF parent also has position declared
child scrolls with parent element
position: fixed;
takes offset values –> based on distance from the viewport
DO NOT scroll aka stay on page
viewport
portion of website viewable to user
float
property used to position element to the left or right of their containing element
float: left;
element is placed to the left and lets other content wrap around it to the right
float: right;
element is placed to the right and lets other content wrap around it to the left
clear
property used after float to prevent elements following floated element from wrapping around floated element
clear: left;
no floating elements allowed on the left side of the cleared element
clear: right;
no floating element allowed on the right side of the cleared element
clear: both;
no floating element allowed on either side of the cleared element
offsets
used to position elements along with relative, fixed, absolute positions
top right bottom left