13 Boxes Flashcards

1
Q

Each html element sort of acts like there is a box around it (even inline elements)
t or f

A

true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

CSS rules must be surruonded by “

t or f

A

F

They can also be ‘

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Control the height and width of a box

A

height: 300px;
width: 300px;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Between px, em, and %, which are best to control the size of a webpage for various sizes?

A

em and %

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
What happens with a p inside a div:
div.box {
height: 300px;
width: 300px;
}
p {
height: 75%;
width: 75%;
;}
A

it’s height and width is set to 75% of the containing element
225px wh

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
What happens with the div box
div.box {
height: 50%;
width: 50%;
}
A

it’s height and width is set to 50% of the containing element (the browser window in this case)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

set a max and min width/height

A
td.description {
min-width: 450px;
max-width: 650px;
text-align: left;
padding: 5px;
margin: 0px;}

p {
min-height: 10px;
max-height: 30px;}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Define what happens when the box shrinks smaller than the text (made it disappear, make it scroll)

A

p. one {
overflow: hidden;}

p. two {
overflow: scroll;}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What’s the difference between padding, margin and border

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Set the border width generally

and

on specific sides (2 ways)

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Set border as solid

A

border-style: solid;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Set the border as a double line (both lines together make the border-width)

A

border-style: double;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Set the border as dotted or dashed

A

p. two {border-style: dotted;}

p. three {border-style: dashed;}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Set border:

  • as if sticking out from the page
  • as if carved into page
  • as in embedded into the page
  • as if embossed
A

p. six {border-style: ridge;}
p. five {border-style: groove;}

p. seven {border-style: inset;}
p. eight {border-style: outset;}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Hide the border

A

border-style: hidden;

border-style: none;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Set border color generally and

on specific sides (2 ways)

A

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;}
17
Q

Use shorthand to control border thickness, style, and color

A

border: 3px dotted #0088dd;

18
Q

Control padding generally
AND
each individual side (2 ways)

A

padding: 10px

padding-top
padding-right
padding-bottom
padding-left
OR
padding: 10px 5px 3px 1px
19
Q

Control margin generally
AND
each individual side (2 ways)

A

margin: 20px;

margin-top
margin-right
margin-bottom
margin-left
OR
margin: 1px 2px 3px 4px;
20
Q

If width/height is used to define a box, how are they affected by margin, border and padding?

A

Margin, Border, and Padding are added to the width/height

21
Q

Center a box

A

margin: 10px auto 10px auto

or

margin: auto;

22
Q

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)

A

display: block;
display: inline;
display: inline-block;
display: none;

23
Q

Hide an element from page but keep the space

make an element visible

A

visibility: hidden;
visibility: visible;

24
Q

Make an image be the border
(2 ways)
(5 rules, short form does 3)

A

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;}

25
Q

Create box drop shadow

A

box-shadow: -5px -5px 2px #777777;

horizontAl offset
Negative values position the
shadow to the left of the box.
verticAl offset
Negative values position the
shadow to the top of the box.
Blur DistAnce
If omitted, the shadow is a solid
line like a border.
sPreAD of shADoW
If used, a positive value will
cause the shadow to expand in
all directions, and a negative
value will make it contract
26
Q

Create an internal drop shadow

A

box-shadow: inset 0 0 10px #777777;}

27
Q

Round box corners generally

Round box corners by corner (2 ways)

A

border-radius: 10px;

border-top-right-radius
border-bottom-right-radius
border-bottom-left-radius
border-top-left-radius
OR
border-radius: 5px, 10px, 5px, 10px;
28
Q

Create unevenly rounded corners. ie more rounded on the top side than the left side of the round
Generally (1 way)
and
Each corner at a time

A
There is also a shorthand for
targetting all four corners at
once; first you specify the four
horizontal values, then the four
vertical values, as shown in the
second shape on the left.

border-radius: 1em 4em 1em 4em / 2em 1em 2em 1em
or
border-radius: 10px / 50px;

border-top-left-radius: 80px 50px

29
Q

margins are additive between boxes
20 + 40 = 60
t or f

A

false

30
Q

How to make it so the height is the height of the padding, margin border and element and the width is the width of the padding, margin border and element (rather than the height and width being just the size of the element)

(Alternative box model)

A

box-sizing: border-box

31
Q

What’s the difference between inline and block elements with respect to:

  • new lines
  • width and height properties
  • how much space they take up on the line
  • what margin border and padding do
A

block, breaks on new line. Inline doesn’t

Block respects width and
height. Inline doesn’t

Block elements stretch the whole line by default.
inline elements are the width of the content.

Blockmargin border and padding will push other elements. Inline will apply but only in the line (x) direction.
If the inline element has as a visible border, it will extend into the line above and below but not push the elements.

32
Q

The way the inside of boxes are formatted and the way outer boxes are formatted is the same
t or f

A

t
there is a distinction between inner and outer display types
But the inside of a box is normal flow by default and can be any of the flow types. (flex etc)

33
Q

What does the width and height control

A

the size of the content (on the inside of the padding)

Unless if you set box-sizing: border-box where height and width will include the padding as well.

34
Q

A hybrid mode between inline and block that makes it push elements up and down as well as left and right. (good for links)
Also these elements can be beside one another

A

display: inline-block

35
Q
What happens if you set margin, border or padding with:
1 number
2 numbers
3 numbers
4 numbers
A

1 all sides
2 topbottom leftright
3 top leftright bottom
4 top left bottom right

36
Q

Center an element using the box model

A

margin: 0 auto

37
Q

What do negative margins do?

A

makes elements go into one another (and their margins)

38
Q

Big difference that comes with inline block

A

Inline block elements can be beside one another but otherwise have border, margin and padding and push other elements out of the way.