Add files via upload
This commit is contained in:
parent
a1ec07ab4f
commit
13f975821d
26
100_projects/18-customize-radio-input/index.html
Normal file
26
100_projects/18-customize-radio-input/index.html
Normal file
@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<title> Customize Radio Input</title>
|
||||
</head>
|
||||
<body>
|
||||
<form action="">
|
||||
<div>
|
||||
<input id="mac" type="radio" name="os" />
|
||||
<label for="mac">Mac</label>
|
||||
</div>
|
||||
<div>
|
||||
<input id="lin" type="radio" name="os" />
|
||||
<label for="lin">Linux</label>
|
||||
</div>
|
||||
<div>
|
||||
<input id="win" type="radio" name="os" />
|
||||
<label for="win">Windows</label>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
64
100_projects/18-customize-radio-input/style.css
Normal file
64
100_projects/18-customize-radio-input/style.css
Normal file
@ -0,0 +1,64 @@
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
body {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
background: #B6D6C8;
|
||||
color: #2C2D2A;
|
||||
}
|
||||
form {
|
||||
width: 350px;
|
||||
margin: 20px auto;
|
||||
background-color: #f9f9f9;
|
||||
padding: 25px 30px;
|
||||
border-radius: 5px;
|
||||
font-size: 21px;
|
||||
}
|
||||
form > div {
|
||||
padding: 5px 0;
|
||||
}
|
||||
form input[type="radio"] {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
form label {
|
||||
position: relative;
|
||||
padding-left: 25px;
|
||||
}
|
||||
form label::before {
|
||||
content: "";
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border: 1px solid #2C2D2A;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
background: white;
|
||||
border-radius: 50%;
|
||||
}
|
||||
form input[type="radio"]:checked + label::after,
|
||||
form input[type="radio"]:not(:checked):hover + label::after {
|
||||
content: "";
|
||||
background-color: #2C2D2A;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
position: absolute;
|
||||
left: 4px;
|
||||
top: 7px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
form input[type="radio"]:not(:checked):hover + label::after {
|
||||
opacity: 0.2;
|
||||
}
|
||||
form input[type="radio"]:checked + label {
|
||||
color: #2C2D2A;
|
||||
padding: 0 30px;
|
||||
background-color: #B6D6C8;
|
||||
border-radius: 5px;
|
||||
}
|
Loading…
Reference in New Issue
Block a user