13 Boxes Flashcards
Each html element sort of acts like there is a box around it (even inline elements)
t or f
true
CSS rules must be surruonded by “
t or f
F
They can also be ‘
Control the height and width of a box
height: 300px;
width: 300px;
Between px, em, and %, which are best to control the size of a webpage for various sizes?
em and %
What happens with a p inside a div: div.box { height: 300px; width: 300px; } p { height: 75%; width: 75%; ;}
it’s height and width is set to 75% of the containing element
225px wh
What happens with the div box div.box { height: 50%; width: 50%; }
it’s height and width is set to 50% of the containing element (the browser window in this case)
set a max and min width/height
td.description { min-width: 450px; max-width: 650px; text-align: left; padding: 5px; margin: 0px;}
p {
min-height: 10px;
max-height: 30px;}
Define what happens when the box shrinks smaller than the text (made it disappear, make it scroll)
p. one {
overflow: hidden;}
p. two {
overflow: scroll;}
What’s the difference between padding, margin and border
Border is the thickness of the box
Margin is the space outside the box border (in between boxes)
Padding is the space between the box border and content
Set the border width generally
and
on specific sides (2 ways)
p.one {
border-width: 2px;}
p.two {
border-width: thick;}
border-top-width border-right-width border-bottom-width border-left-width OR p.three { border-width: 1px 4px 12px 4px;} top, right, bottom, left
Set border as solid
border-style: solid;
Set the border as a double line (both lines together make the border-width)
border-style: double;
Set the border as dotted or dashed
p. two {border-style: dotted;}
p. three {border-style: dashed;}
Set border:
- as if sticking out from the page
- as if carved into page
- as in embedded into the page
- as if embossed
p. six {border-style: ridge;}
p. five {border-style: groove;}
p. seven {border-style: inset;}
p. eight {border-style: outset;}
Hide the border
border-style: hidden;
border-style: none;
Set border color generally and
on specific sides (2 ways)
p.one {
border-color: #0088dd;}
border-top-color border-right-color border-bottom-color border-left-color OR p.two { border-color: #bbbbaa #111111 #ee3e80 #0088dd;}
Use shorthand to control border thickness, style, and color
border: 3px dotted #0088dd;
Control padding generally
AND
each individual side (2 ways)
padding: 10px
padding-top padding-right padding-bottom padding-left OR padding: 10px 5px 3px 1px
Control margin generally
AND
each individual side (2 ways)
margin: 20px;
margin-top margin-right margin-bottom margin-left OR margin: 1px 2px 3px 4px;
If width/height is used to define a box, how are they affected by margin, border and padding?
Margin, Border, and Padding are added to the width/height
Center a box
margin: 10px auto 10px auto
or
margin: auto;
Turn an inline element into a block element
turn a block element into an inline element
Make a block element flow like an inline element but retain other block features
Hide an element from page (and eliminate space)
display: block;
display: inline;
display: inline-block;
display: none;
Hide an element from page but keep the space
make an element visible
visibility: hidden;
visibility: visible;
Make an image be the border
(2 ways)
(5 rules, short form does 3)
This property requires three
pieces of information:
border-image-source: url(“location”) (it doesn’t need the quotation marks)
Can also be linear-gradient or repeating-linear-gradient
border-image-slice: 1to4 numeric values separated by space
border-image-slice: 11 11 11 11 (or just 11 for all)
it’s 11 pixels from the top of the image, 11 from right etc.
Units can be:
no units- is pixels. Can’t do px.
%- percent of the image to place in each slot
fill- after numbers to include the
border-image-repeat: stretch /* Keyword value */ border-image-repeat: stretch; border-image-repeat: repeat; border-image-repeat: round; border-image-repeat: space; /* vertical | horizontal */ border-image-repeat: round stretch; /* Global values */ border-image-repeat: inherit; border-image-repeat: initial; border-image-repeat: revert; border-image-repeat: unset;
border-image-width: 1to4 numeric values separated by space
Can expand
border-image-outset: 1to4 numeric values separated by space
OR
all in one
border-image: url(“images/dots.gif”)
11 11 11 11 stretch;}