- index.html
- style.css
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>The transition-property: which properties can be changed smoothly?</title>
<meta charset="utf-8">
<link rel="stylesheet" href="material.css">
<link rel="stylesheet" href="style.css">
</head>
<body class="theory-theme">
<button class="btn" type="button"></button>
</body>
</html>
CSS
.btn {
background-color: #00e676;
color: #ffffff;
transition-duration: 1s;
transition-property: all;
}
.btn-active {
background-color: #ff5252;
font-size: 60px;
transform: rotate(180deg);
}
You’ve gone to a different page
Goalscompleted
0
- For the
.btn
button, assign a smooth transition only for thebackground-color
property, - then assign a smooth transition only for the
transform
property, - and finally assign
background-color, transform
for both properties at the same time. - Change the duration of the transition for
.btn
to1s, 3s
.
Click the .btn
button in the mini-browser to switch its btn-active
class and see a smooth transition.
Comments