WEB-DEVELOPMENT-FOUNDATION practice question 3 of 15
What is matched by the :hover selector?
Full set: 75 questionsThe :hover pseudo-class in CSS is a user action pseudo-class that applies styles to an element when a user interacts with it using a pointing device, but does not necessarily activate it. This state is most commonly triggered when the user's cursor (mouse pointer) is positioned over the element. It is used to provide visual feedback to the user, indicating that the element is interactive.
A. Any element that has no children: This is incorrect. This condition is matched by the :empty pseudo-class, not :hover.
B. Any element text that is indicated by the user: This is incorrect. This describes the ::selection pseudo-element, which styles the portion of a document highlighted by the user.
D. Any element that is user-editable: This is incorrect. This describes elements with the contenteditable attribute or enabled form inputs, which are not specifically targeted by :hover.
1. Mozilla Developer Network (MDN) Web Docs: In the documentation for CSS Pseudo-classes, :hover is defined as matching "when the user interacts with an element with a pointing device, but does not necessarily activate it. It is generally triggered when the user hovers over an element with the cursor (mouse pointer)."
Source: MDN Web Docs, ":hover", retrieved from https://developer.mozilla.org/en-US/docs/Web/CSS/:hover
2. W3C (World Wide Web Consortium) Specification: The official CSS Selectors Level 4 specification defines :hover under the "User Action Pseudo-classes" section. It states, "The :hover pseudo-class applies while the user designates an element with a pointing device, but does not activate it."
Source: W3C, "Selectors Level 4", Section 8.3. User Action Pseudo-classes: :hover, :active, :focus, retrieved from https://www.w3.org/TR/selectors-4/#hover-pseudo
3. MIT OpenCourseWare: In the course materials for "6.170 Software Studio," CSS selectors are explained. The :hover selector is consistently described as applying styles when the mouse cursor is over an element, which aligns with the correct answer.
Source: MIT OpenCourseWare, "6.170 Software Studio, Lecture 5: HTML & CSS", Section on CSS Selectors.
Keep practicing
Take the free WEB-DEVELOPMENT-FOUNDATION practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other WEB-DEVELOPMENT-FOUNDATION practice questions
- Question 2What is one of the possible values of the text-align property?
- Question 4What describes the matches resulting from the img: first-child selector?
- Question 5Which two color definitions are valid for use with CSS? Choose 2 answers.
- Question 8What does the timelines tool of Safari Web Inspector enable a developer to do?
- Question 9Developers consider three platforms for viewport sizes. What is one of them?
- Question 10Which CSS unit is a relative unit?
