What is a CSS pseudo-class?
Instruction: Define a pseudo-class in CSS and provide examples of its use.
Context: This question evaluates the candidate's knowledge of pseudo-classes in CSS, which are used to define special states of elements.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
A pseudo-class matches an element according to a condition beyond its name or class, such as interaction, validation or position among siblings. It styles an existing element; a pseudo-element such as ::before represents a different kind of styling target.
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>CSS example</title> <style> button:hover { background: #eee;...
Related Questions
-
easy
-
easy
-
medium
-
medium
-
medium
-
medium