2.1 Selectors Flashcards

1
Q

type/element selector

A

matches element name

a { }

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

Universal Selector

A

Applies to all elements in the document

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

Class selectors

A

Matches an element with the same class attribute

.note { }

targets all elements with this class

p.note { }
targets only p tags with the specified class

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

ID selector

A

introduction { }

Matches element with the id

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

Child Selector

A

Matches an element that is a direct child of another

li>a { }

Targets any a elements that are children of li tags (but not other a tags)

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

Descendent Selector

A

Matches an element that is a descendent of another specified element (not just a direct child of an element)

p a { }

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

Adjacent Sibling

A

h1+p { }

Matches an element that is the next sibling of another

Targets the first p tag after any h1 tag

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

General Sibling selector

A

h1~p { }

Matches an element that is sibling of another, although it does not have to be directly preceding element

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

important

A

Overirdes all css. Always at end of rule.

p {
color: blue !important;
}

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

hover pseudo selector

A

a:hover

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

active pseudo selector

A

a:active

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

focus pseudo selector

A

input:focus

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

existence attribute selector

A

Matches a specific attrbute
[ ]

p[class]

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

equality attribute selector

A

Matches a specific attribute with a specific value

[=]

p[class=”dog”]

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

Space attribute selector

A

Matches a specific attribute whose value appears in a space separated list of words

p[class~=”dog”]

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

Prefix attribute selector

A

[^=]

Matches a specific attribute whose value begins with a specific string

p[attr^=’d’]

17
Q

Substring attribute selector

A

[*=]

Matches a specific attribute whose value contains a specific substring

p[attr*“do”]

18
Q

Suffix attribute selector

A

[$=]

Matches a specific attribute whose value ends with a specific string

p[attr$”g”]