Make a colour change smooth.
What to build
A transition on a button.
Requirements
.buttonhas abackgroundofteal..buttonhas a transition ofbackground-colorover0.2s..button:hoverhas abackgroundofnavy.
Constraints
Do not write transition: all.
Example
transition: color 0.3s ease;
Why it works
With the transition on the normal state, the browser smooths the change in both directions.
Hints
Hint 1
The transition belongs on .button, not on the hover rule.
Solution
Show one correct solution (try it yourself first)
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Transition</title>
<style>
.button {
background: teal;
transition: background-color 0.2s ease;
}
.button:hover { background: navy; }
</style>
</head>
<body>
<button class="button">Press</button>
</body>
</html>