Skip to main content

--description--

This challenge will touch on the usage of pseudo-classes. A pseudo-class is a keyword that can be added to selectors, in order to select a specific state of the element.

For example, the styling of an anchor tag can be changed for its hover state using the :hover pseudo-class selector. Here's the CSS to change the color of the anchor tag to red during its hover state:

a:hover {
color: red;
}

--instructions--

The code editor has a CSS rule to style all a tags black. Add a rule so that when the user hovers over the a tag, the color is blue.

--hints--

The anchor tag color should remain black, only add CSS rules for the :hover state.

assert($('a').css('color') == 'rgb(0, 0, 0)');

The anchor tag should have a color of blue on hover.

assert(
code.match(
/a:hover\s*?{\s*?color:\s*?(blue|rgba\(\s*?0\s*?,\s*?0\s*?,\s*?255\s*?,\s*?1\s*?\)|#00F|rgb\(\s*?0\s*?,\s*?0\s*?,\s*?255\s*?\))\s*?;\s*?}/gi
)
);

--seed--

--seed-contents--

<style>
a {
color: #000;
}



</style>
<a href="https://freecatphotoapp.com/" target="_blank">CatPhotoApp</a>

--solutions--

<style>
a {
color: #000;
}
a:hover {
color: rgba(0,0,255,1);
}
</style>
<a href="https://freecatphotoapp.com/" target="_blank">CatPhotoApp</a>