CSS3 Flashcards
Box Model order
Content, Padding, Border, Margin
Content
text inside of an HTML element
Padding
space within an element’s border (or inside of margin if there is no border)
Border
forms a line around the element (and padding)
Margin
space outside of the element’s border, or outside the padding if there is no border
Trick to centering content
width: 650px;
margin: 0 auto
- set fixed width; sets left/right margin to auto centers content horizontally
- set these attributes to a div with ID “wrapper”
- wrap div around site’s content, centers even when window resizes.
elements that are usually inline
<i></i>
<span></span>
<b></b>
box-sizing inline elements
- can’t have margin/padding on their top/bottom
- can be next to other elements
box-sizing block elements
- can have margin/padding on their top/bottom
- cannot be next to other elements
elements that are usually block
<p></p>
<div></div>
attribute to change an element’s default behavior
display
display: inline
element is displayed inside the current block on the same line as other elements it is near
display: block
element tolerates no elements next to it unless a float is used
display: inline-block
allows a block element to be next to another block element, but still have vertical padding/margins
float: left/right
move an element all the way to the left/right side of its container and have all other elements flow around it