CSS Selectors Flashcards

1
Q

what is a css selector

A

a pattern rule that matches style rules to a specific element or elements

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

css selector: type

A

match elements by node name

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

css selector: .class

A

matches elements based on the contents of the element’s class attribute

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

css selector: #id

A

match an element based on the contents of that element’s id attribute

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

css selector: *

A

universal selector, matches all elements on the page

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

css selector: element > element

A

child selector, matches an element that is a direct child of another

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

css selector: element element

A

descendant selector, matches an element that is a descendent of another specified element

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

css selector: element + element

A

adjacent sibling selector, matches an element that is the next sibling of another

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

css selector: element ~ element

A

general sibling selector, matches an element that is a sibling of another

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

css selector: element[attr]

A

represents an element with an attribute name of attr

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

css selector: element[attr=”value”]

A

represents an element with an attribute name of attr and whose value is exactly “value”

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

css selector: element[attr~=”value”]

A

represents an element with an attribute name of attr whose value is a whitespace-separated list of words, one of which is exactly “value”

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

css selector: element[attr|=”value”]

A

represents an element with an attribute name of attr. Its value can be exactly “value” or can begin with “value”

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

css selector: element[attr^=”value”]

A

represents an element with an attribute name of attr and whose first value is prefixed by “value”

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

css selector: element[attr$=”value”]

A

represents an element with an attribute name of attr and whose last value is suffixed by “value”

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

css selector: element[attr*=”value”]

A

represents an element with an attribute name of attr and whose value contains at least one occurrence of string “value” as substring

17
Q

css specificity weight: type

A

0-0-1

18
Q

css specificity weight: .class

A

0-1-0

19
Q

css specificity weight: #id

A

1-0-0

20
Q

when combining css selectors, what is the key selector

A

the last selector farthest to the right

21
Q

what does the key selector do

A

identifies exactly which element the styles will be applied to

22
Q

when combining css selectors, what are prequalifiers

A

any selector to the left before the key selector