CSS Basics Flashcards

1
Q

How do you apply styling to an html element, like <p>

A

p { … }

// this is a CSS selector

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

How do you apply styling to a class, eg myClass

A

.myClass { … }

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

How do you applying styling to an id, eg myId

A

myId { … }

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

How do you apply the class “big” to all p elements?

A

p.big { … }

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

How do you style all p elements that are DIRECT children of article elements?

A

article > p { … }

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

How do you style all p elements that are descendants (not DIRECT children) of article elements?

A

article p { … }

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

How do you style an element that has two specific classes applied to it, eg ‘highlight’ and ‘mainpoint’?

A

.highlight.mainpoint { … }

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

Use a pseudo-class selector to style buttons on hover?

A

button:hover { … }

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

How do you style div and p the same?

A

div, p { … }

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

How to style 4th li in ul on hover?

A

ul li:nth-child(4):hover { … }

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

Add a style sheet to an html document

A

<head>
<link></link>
</head>

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

How can you reset browser style defaults?

A

Using CSS reset
Examples:
https://meyerweb.com/eric/tools/css/reset/reset.css
https://github.com/joshuaclayton/blueprint-css/blob/master/blueprint/src/reset.css

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

How to apply styling to every element?

A
  • { … }
    (called the universal or star selector)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How to prevent padding from making an element bigger?

A

box-sizing: border-box;

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