CSS Selectors Flashcards

1
Q

What will this selector target?

.intro {
color: blue
{

A

Selects all elements with class=”intro”

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

What will this selector target?

#firstname	 {
color: blue
 {
A

Selects the element with id=”firstname”

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

What will this selector target?

  • {
    color: blue
    {
A

Selects all elements

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

What will this selector target?

p {
color: blue
{

A

Selects all p elements p

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

What will this selector target?

div, p {
color: blue
{

A

Selects all div elements and all p elements

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

What will this selector target?

div > p {
color: blue
{

A

Selects all p elements where the parent is a div> element

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

What will this selector target?

div + p {
color: blue
{

A

Selects all p> elements that are placed immediately after div> elements

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

What will this selector target?

p ~ ul {
color: blue
{

A

Selects every ul> element that are preceded by a p> element

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

What will this selector target?

[target] {
color: blue
{

A

Selects all elements with a target attribute

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

What will this selector target?

[target=_blank] {
color: blue
{

A

Selects all elements with target=”_blank”

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

What will this selector target?

[title~=flower] {
color: blue
{

A

Selects all elements with a title attribute containing the word “flower”

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

What will this selector target?

[lang|=en] {
color: blue
{

A

Selects all elements with a lang attribute value starting with “en”

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

What will this selector target?

a[href^=”https”] {
color: blue
{

A

Selects every a> element whose href attribute value begins with “https”

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

What will this selector target?

a[href$=”.pdf”] {
color: blue
{

A

Selects every a> element whose href attribute value ends with “.pdf”

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

What will this selector target?

a[href*=”w3schools”] {
color: blue
{

A

Selects every a> element whose href attribute value contains the substring “w3schools”

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

What will this selector target?

a:active {
color: blue
{

A

Selects the active link

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

What will this selector target?

p::after {
color: blue
{

A

Insert something after the content of each p> element

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

What will this selector target?

p::before {
color: blue
{

A

Insert something before the content of each p> element

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

What will this selector target?

input:checked {
color: blue
{

A

Selects every checked input> element

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

What will this selector target?

input:disabled {
color: blue
{

A

Selects every disabled input> element

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

What will this selector target?

p:empty {
color: blue
{

A

Selects every p> element that has no children (including text nodes)

22
Q

What will this selector target?

input:enabled {
color: blue
{

A

Selects every enabled input> element

23
Q

What will this selector target?

p:first-child {
color: blue
{

A

Selects every p> element that is the first child of its parent

24
Q

What will this selector target?

p::first-letter {
color: blue
{

A

Selects the first letter of every p> element

25
What will this selector target? p::first-line { color: blue            {
Selects the first line of every p> element
26
What will this selector target? p:first-of-type { color: blue            {
Selects every p> element that is the first p> element of its parent
27
What will this selector target? input:focus { color: blue            {
Selects the input element which has focus
28
What will this selector target? a:hover { color: blue            {
Selects links on mouse over
29
What will this selector target? input:in-range { color: blue            {
Selects input elements with a value within a specified range
30
What will this selector target? input:invalid { color: blue            {
Selects all input elements with an invalid value
31
What will this selector target? p:lang(it) { color: blue            {
Selects every p> element with a lang attribute equal to "it" (Italian)
32
What will this selector target? p:last-child { color: blue            {
Selects every p> element that is the last child of its parent
33
What will this selector target? p:last-of-type { color: blue            {
Selects every p> element that is the last p> element of its parent
34
What will this selector target? a:link { color: blue            {
Selects all unvisited links
35
What will this selector target? :not(p) { color: blue            {
Selects every element that is not a p> element
36
What will this selector target? p:nth-child(2) { color: blue            {
Selects every p> element that is the second child of its parent
37
What will this selector target? p:nth-last-child(2) { color: blue            {
Selects every p> element that is the second child of its parent, counting from the last child
38
What will this selector target? p:nth-last-of-type(2) { color: blue            {
Selects every p> element that is the second p> element of its parent, counting from the last child
39
What will this selector target? p:nth-of-type(2) { color: blue            {
Selects every p> element that is the second p> element of its parent
40
What will this selector target? p:only-of-type { color: blue            {
Selects every p> element that is the only p> element of its parent
41
What will this selector target? p:only-child { color: blue            {
Selects every p> element that is the only child of its parent
42
What will this selector target? input:optional { color: blue            {
Selects input elements with no "required" attribute
43
What will this selector target? input:out-of-range { color: blue            {
Selects input elements with a value outside a specified range
44
What will this selector target? input:read-only { color: blue            {
Selects input elements with the "readonly" attribute specified
45
What will this selector target? input:read-write { color: blue            {
Selects input elements with the "readonly" attribute NOT specified
46
What will this selector target? input:required { color: blue            {
Selects input elements with the "required" attribute specified
47
What will this selector target? :root { color: blue            {
Selects the document's root element
48
What will this selector target? ::selection { color: blue            {
Selects the portion of an element that is selected by a user
49
What will this selector target? ``` #news:target { color: blue            { ```
Selects the current active #news element (clicked on a URL containing that anchor name)
50
What will this selector target? input:valid { color: blue            {
Selects all input elements with a valid value
51
What will this selector target? a:visited { color: blue            {
Selects all visited links