- index.html
- style.css
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Radio buttons, step 3</title>
<meta charset="utf-8">
<link rel="stylesheet" href="material.css">
<link rel="stylesheet" href="style.css">
</head>
<body class="yellow-theme">
<section class="card">
<h1 class="question"><span>What CSS property can you use to hide an element?</span></h1>
<form class="answers" action="https://echo.htmlacademy.ru/courses" method="post">
<button class="fab" type="submit"></button>
<div>
<input type="radio" name="answer" id="answer1">
<label for="answer1">transparency</label>
</div>
<div>
<input type="radio" name="answer" id="answer2">
<label for="answer2">opacity</label>
</div>
<div>
<input type="radio" name="answer" id="answer3">
<label for="answer3">invisibility</label>
</div>
</form>
</section>
</body>
</html>
CSS
label {
position: relative;
cursor: pointer;
}
label::before,
label::after {
position: absolute;
top: 0;
left: -42px;
border-radius: 50%;
content: "";
}
label::before {
width: 12px;
height: 12px;
border: solid 2px #5a5a5a;
}
label::after {
width: 16px;
height: 16px;
background-color: #00bad2;
transform: scale(1.1);
}
input[type="radio"] {
display: none;
}
input[type="radio"]:checked ~ label::after {
}
You’ve gone to a different page
Goalscompleted
0
- In the
label::after
CSS rule, change the transform totransform: scale(0)
. - Assign the
transform: scale(1.1)
transform for the active state of the closer. - Finally, in the
label::after
rule, assign a smooth transition for thetransform
property that is0.28s
in duration.
Toggle the radio button to test the result.
- Select the correct answer to the quiz question, and press the round button to check your answer.
Comments