WorksheetsCSS Pseudo-classes Quiz
Total questions: 11
Worksheet time: 6mins
What is a pseudo-class used for?
To add comments in CSS
To style images only
To create a new HTML element
To define a special state of an element
Which pseudo-class styles an element when a user moves the mouse over it?
:focus
:hover
:active
:visited
Which pseudo-class is used to style visited links?
:link
:active
:hover
:visited
What is the correct syntax for a pseudo-class?
selector:pseudo-class: { property: value; }
selector:pseudo-class { property: value; }
selector:pseudo-class: property: value;
selector:pseudo-class { value: property; }
What does the :first-child pseudo-class match?
The first child of an element
The last child of an element
All children of an element
No children of an element
Which of the following is a valid use of the :hover pseudo-class?
a:hover.highlight { color: #ff0000; }
a.highlight:hover { color: #ff0000; }
a:hover { highlight: #ff0000; }
a:hover { color: #highlight; }
What happens when you hover over a link with the :hover pseudo-class?
The link becomes bold
The link gets underlined
The link disappears
The link changes color
What is the purpose of the :lang pseudo-class?
To define styles for different languages
To remove styles from elements
To create new languages
To style links only
Which of the following is NOT a pseudo-class?
:focus
:style
:link
:hover
What does the :active pseudo-class represent?
An element that is being clicked
An element that is not clicked
An element that is hovered over
An element that is focused
Which property is used to change the background color of an element on hover?
color
text-color
background-color
border-color
