Selectors Flashcards

1
Q

Type selector vs. Universal selector

A

Type selector selects all elements by their tag

Universal selector selects all element

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

What symbol does the universal selector use?

A

*

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

Class attribute

A

Applied to HTML code, it is used to select things in CSS
For example:
< p class = “brand” > Shoe Company < / p >

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

How do you select something from the class attribute in CSS

A

Dot then the text
For example:
.brand {

}

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

How would you add multiple classes to an HTML element

A

Separate them with a space
For example:
< p class = “ green bold “ >Green and bold text< / p >

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

Class vs. Id attribute

A

Class can be used for multiple elements

ID can only be used for one element

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

How do you select an element’s ID for CSS

A

Put a # in front of the name

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

How do you use the <em>attribute selector</em>

A
Surround the attribute you want to target with brackets in CSS
For example:
[href] {
    color: magenta;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do you select attributes with a specific value?

A
type[attribute*=value}
For example:
<em>For < img src='summer' /></em>
img[src*='summer'] {
height: 50px;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are pseudo-class selectors?

A

A line of code that changes the appearance of certain elements for user interactions
For example:
An anchor element turning purple after you click on it

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

How do you attach a pseudo-class to a selector?

A
Put the element name, colon, and then the name of the pseudo-class
For example:
p:hover {
   background color: lime;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does the hover pseudo-class do?

A

Changes something when you hover over it with your mouse
For example:
If you hover over an anchor it will change color

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

How to give an element a background color?

A

With the <em>background-color:</em>

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

Order of specificity for CSS (highest to lowest)

A

ID, class, type

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

What is chaining?

A

Combing CSS selectors

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

What does the <em>descendant combinator</em> allow you to do?

A

Allows you to select elements nested inside of other elements
For example:
.main-list li {

}

17
Q

How do you write multiple selectors for one rule?

A
Separate the selectors with a comma
For example:
h1,
.menu {
  font-family: Georgia;
}