250+ TOP MCQs on Using Advanced Selectors and Answers

CSS Multiple Choice Questions on “Using Advanced Selectors”.

1. Which of the following selector selects all elements of E that have the attribute attr that end with the given value?

a) E[attr^=value]
b) E[attr$=value]
c) E[attr*=value]
d) none of the mentioned

Answer: b
Clarification:

Example: p[title$="!"] {color: red;}

2. Which of the following selector selects the elements that are checked?

a) E ~ F
b) ::after
c) :checked
d) none of the mentioned

Answer: c
Clarification:

Example: :checked {color: blue;}

3. Which of the following selector selects the elements that are the default among a set of similar elements?

a) :default
b) :%
c) :disabled
d) none of the mentioned

Answer: a
Clarification:

Example: :default {background-color: red;}

4. Which of the following selector selects an element that has no children?

a) :empty
b) :nochild
c) :inheritance
d) :no-child

Answer: a
Clarification: None.

5. Which of the following selector selects the elements that are currently enabled?

a) :element
b) :empty
c) :enabled
d) none of the mentioned

Answer: c
Clarification:

Example: input:enabled {background-color:white;}

6. Which of the following selector selects the element that is the first child of its parent that is of its type?

a) :first-of-type
b) :last-child
c) ::first-line
d) ::first-letter

Answer: a
Clarification:

Example: strong:first-of-type {font-size:bigger;}

7. Which of the following selector selects elements that do not match the selector s?

a) :!(s)
b) :nth-child(s)
c) :not(s)
d) none of the mentioned

Answer: c
Clarification:

Example: *:not(h1) {color: black;}

8. Which of the following selector selects an element if it’s the only child of its parent?

a) :root
b) :nth-oftype(n)
c) :only-child
d) none of the mentioned

Answer: c
Clarification:

Example: h1:only-child {color: blue;}

9. Which of the following selector selects the element that is the target of a referring URI?

a) :target
b) :selection
c) ::selection
d) :URI

Answer: a
Clarification:

Example: :target{color:red;}

10. Which of the following selector applies styles to elements that are valid per HTML5 validations set either with the pattern or type
attributes?

a) :valid
b) :required
c) :optional
d) :invalid

Answer: a
Clarification:

Example: :valid {color: green;}
  250+ TOP MCQs on Server Specific CSS and Answers

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top