CSS Basics Flashcards

(22 cards)

1
Q

What will the font color be of this h2 element given the following selector property values?

h2 {
    color: blue;
    color: red;
}
A

Red. CSS stands for cascading style sheets; the cascading part applies here. The later property value will overwrite the first one.

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

Consider the following CSS font-family: font-family: Jazzier, Garamond, serif; If Jazzier is not found on the local user’s computer, what font will load?

A

It will try Garamond before falling back to serif.

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

Consider the following font-family: font-family: Arial, 'Helvetica', sans-serif;. Arial is invalid because it is not in quotations, true or false?

A

False. Quotes are optional for font names without spaces.

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

In HTML, everything visible on the screen is a descendant of the body element, true or false?

A

True

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

Consider the following selectors:

body {
    font-family: sans-serif;
    color: #1b281b
}

header{
    text-align: center;
}

What will the color of the header font be? Why?

A

1b281b (black). This color is inherited from the parent (body).

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

Consider the following selectors:

body {
    font-family: sans-serif;
    color: #1b281b
}

h1 {
    color: #4676a9;
    text-align: center;
}

What will the color of the h1 font be? Why?

A

4676a9 (blue). The child (h1) has broken inheritance from its parent (body) and declared its own color.

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

What does the font-size selector represent?

A

Indicates the desired height of glyphs from the font. For scalable fonts, the font-size is a scale factor applied to the EM unit of the font.

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

What does the font-weight selector represent?

A

Specifies weight of glyphs in the font, their degree of blackness or stroke thickness.

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

What are User Agent Stylesheet?

A

Default styles coming from the browser.

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

Consider the following selector:

a {
    color: inherit;
}

Assume that there is a <p> element that contains a link (<a>). What color will that link be?

A

The link color will inherit from the parent that contains it. This selector is used to override the User Agent Stylesheet.

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

Consider the following selectors:

html {
    font-size: 50px;
}
h1 {
    font-size: 2rem;
}

What is the size of the h1 font, in pixels?

A
  1. rem represents the root relative size. 2em is relative to 50px and will thus be twice as large (100px). If it were 3em, the h1 font would be 150px.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the default font-size on an html element, in terms of pixels?

A

16px, but this can be changed by user preference.

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

The line-height selector does what?

A

Controls the space between the lines inside a block of text

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

The margin selector does what?

A

The space between individual blocks of text

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

What is the default line-height?

A

1.4

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

The logical version of a block’s height selector is ________

A

block-size. Use sparingly. It’s an easy way to cause overlap!

17
Q

Consider a block element’s size. It’s width is as _____ as it can be, and its height is as _____ as possible.

A

wide; small. Blocks take up the full width of the screen and occupy as little height as possible. As the page narrows, the width will contract and the height will increase.

18
Q

The ______ selector is the logical version of a block’s width.

A

inline-height

19
Q

How many values can you provide to the padding selector?

A
  1. For example, padding: 10px 20px 30px 40px;. This applies the padding in a clockwise order, starting from the top. You can also supply 1, 2, or 3 values.
20
Q

the border short-hand selector can accept three arguments, the order of which does not matter. True or false?

A

True. For example, the following selector is valid: border: solid 10px red;.

21
Q

margin and padding both add empty space. Which includes the background?

22
Q

What selector can we use to apply values to every element?