CSS 1 Flashcards

1
Q

What are the names of the individual pieces of a CSS rule?

A

selector and declaration block with property name: value

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

In CSS, how do you select elements by their class attribute?

A
.
dot followed by class name
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In CSS, how do you select elements by their type?

A

name of the element

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

In CSS, how do you select an element by its id attribute?

A
#
hashtag followed by id name
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Name three different types of values you can use to specify colors in CSS.

A

color keywords “black”, RGB color values “rgb(0, 0, 0)”, Hexadecimal color values “#000000”

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

What CSS properties make up the box model?

A

content, padding, border, margin

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

Which CSS property pushes boxes away from each other?

A

margin

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

Which CSS property adds space between a box’s content and its border?

A

padding

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

What is a pseudo-class?

A

a selector, choosing only elements in a special state, such as “:hover” or “:first-child”

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

What are CSS pseudo-classes useful for?

A

They allow you to apply a style to an element in relation to external factors, such as if the mouse is over an element or target the first child element

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

What CSS property controls the font used for the text inside an element?

A

font-family

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

What is the default flex-direction of a flex container?

A

row (from left to right)

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

What is the default flex-wrap of a flex container?

A

nowrap

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

Why do two < div > elements “vertically stack” on one another by default?

A

< div > elements are block-level

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

What is the default flex-direction of an element with display: flex?

A

row (from left to right)

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

What does box-sizing: border-box do?

A

allows for padding andborderto be included in an element’s total width and height

17
Q

What is the default value for the position property of HTML elements?

A

static

18
Q

How does setting position: relative on an element affect document flow?

A

document flow does not adjust

19
Q

How does setting position: relative on an element affect where it appears on the page?

A

where it appears with only “position: relative” does not change

20
Q

How does setting position: absolute on an element affect document flow?

A

an element gets removed completely from doc flow

21
Q

How does setting position: absolute on an element affect where it appears on the page?

A

element appears in first non-static parents

22
Q

What is the purpose of using “position: absolute”?

A

Layering elements

23
Q

How do you constrain an absolutely positioned element to a containing block?

A

use “position: non-static” or “relative” on containing block

24
Q

What are the four box offset properties?

A

top, right, left, bottom

25
Q

What does “position: fixed” do?

A

element is glued to the viewport, can’t be moved by scrolling