CSS Multiple Choice Questions & Answers focuses on “Advanced Selectors”.
Q 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
Show Answer
Answer:-C. E[attr$=value]Explanation
Example: p[title$=”!”] {color: red;}Q 2. Which of the following selector selects the elements that are checked?
A. E ~ F
B. ::after
C. :checked
D. none of the mentioned
Show Answer
Answer:-C. :checkedExplanation
Example: :checked {color: blue;}Q 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
Show Answer
Answer:-A. :defaultExplanation
Example: :default {background-color: red;}Q 4. Which of the following selector selects an element that has no children?
A. :no-child
B. :nochild
C. :inheritance
D. :empty
Show Answer
Answer:-D. :emptyQ 5. Which of the following selector selects the elements that are currently enabled?
A. :enabled
B. :empty
C. :element
D. none of the mentioned
Show Answer
Answer:-A. :enabledExplanation
Example: input:enabled {background-color:white;}Q 6. Which of the following selector selects the element that is the first child of its parent that is of its type?
A. :last-child
B. :first-of-type
C. ::first-line
D. ::first-letter
Show Answer
Answer:-B. :first-of-typeExplanation
Example: strong:first-of-type {font-size:bigger;}Q 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
Show Answer
Answer:-C. :not(s)Explanation
Example: *:not(h1) {color: black;}Q 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
Show Answer
Answer:-C. :only-childExplanation
Example: h1:only-child {color: blue;}Q 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
Show Answer
Answer:-A. :targetExplanation
Example: :target{color:red;}Q 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. :invalid
B. :required
C. :optional
D. :valid
Leave a Reply