Skip to content

Courses / CSS3 Mastery: Beginner to Advanced / Pseudo-Classes

2,091 people viewed this

Pseudo-Classes

Quiz — 10 MCQs

  1. What does :hover represent? (A) Pointer hover state (B) Disabled state (C) First child (D) Empty element. Answer: A. It matches an element while hovered.
  2. What does :focus match? (A) Focused element (B) Last child only (C) All links (D) All images. Answer: A. It matches the element that has focus.
  3. What is :focus-visible useful for? (A) Visible focus styling when appropriate (B) Database access (C) Image compression (D) Grid placement. Answer: A. It helps expose keyboard focus without requiring identical styling in every focus situation.
  4. What does :checked match? (A) Checked controls (B) Every input (C) Disabled links (D) First paragraphs. Answer: A. It matches checked radio buttons, checkboxes and applicable options.
  5. What does :nth-child(even) select? (A) Even-numbered sibling positions (B) Every element with even text length (C) Only even IDs (D) All children without parents. Answer: A. It matches even positions in the sibling list.
  6. What does :first-child select? (A) An element that is the first child of its parent (B) Every first paragraph in the document (C) Only the first HTML tag (D) All headings. Answer: A. It is based on sibling position.
  7. Which pseudo-class matches a disabled input? (A) :disabled (B) :active (C) :hover (D) :visited. Answer: A. It matches disabled controls.
  8. What does :not(.selected) mean? (A) Does not match the selected class (B) Must have selected (C) Is a link (D) Is focused. Answer: A. It excludes elements matching that selector.
  9. Why should focus indicators remain visible? (A) To support keyboard users (B) To increase image size (C) To load CSS faster (D) To hide form labels. Answer: A. Focus indicators help users understand keyboard position.
  10. Does :nth-of-type() count every type of sibling? (A) Yes (B) No, it counts matching element types (C) Only IDs (D) Only classes. Answer: B. It counts siblings of the same element type.

Key Takeaways

  • Pseudo-classes match element states and relationships.
  • Use structural selectors to style elements by position.
  • Provide accessible focus indicators and test keyboard interaction.

Rate this course

No ratings yet — yours can be the first.

Stars show on this course. Your written note stays private.

Your stars