<h1>Things to do today</h1>
<ol class="switches">
<li>
<input type="checkbox" id="1">
<label for="1">
<span>Tidy the Car</span>
<span></span>
</label>
</li>
<li>
<input type="checkbox" id="2">
<label for="2">
<span>Exercise</span>
<span></span>
</label>
</li>
<li>
<input type="checkbox" id="3">
<label for="3">
<span>Watch a Movie</span>
<span></span>
</label>
</li>
<li>
<input type="checkbox" id="4">
<label for="4">
<span>Listen to Music</span>
<span></span>
</label>
</li>
<li>
<input type="checkbox" id="5">
<label for="5">
<span>Try a New Recipe</span>
<span></span>
</label>
</li>
<li>
<input type="checkbox" id="6">
<label for="6">
<span>Do Some Gardening</span>
<span></span>
</label>
</li>
<li>
<input type="checkbox" id="7">
<label for="7">
<span>Play Free Online Games</span>
<span></span>
</label>
</li>
<li>
<input type="checkbox" id="8">
<label for="8">
<span>Take an Online Course</span>
<span></span>
</label>
</li>
</ol>
<footer class="page-footer">
<small>Made with <span>❤</span> by <a href="https://georgemartsoukos.com/" target="_blank">George Martsoukos</a>
</small>
</footer>
:root {
--white: #e8e9ed;
--gray: #434257;
--blue: #18172c;
--green: #00d084;
--pink: #ff4b77;
}
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
a {
color: inherit;
text-decoration: none;
}
ol {
list-style: none;
}
label {
cursor: pointer;
}
[type="checkbox"] {
position: absolute;
left: -9999px;
}
body {
font-size: 20px;
font-family: "Roboto Slab", serif;
margin: 50px 0;
}
h1 {
font-size: 2rem;
text-align: center;
}
.switches {
max-width: 500px;
width: 95%;
margin: 50px auto 0;
border-radius: 5px;
color: var(--white);
background: var(--blue);
}
.switches li {
position: relative;
counter-increment: switchCounter;
}
.switches li:not(:last-child) {
border-bottom: 1px solid var(--gray);
}
.switches li::before {
content: counter(switchCounter);
position: absolute;
top: 50%;
left: -30px;
transform: translateY(-50%);
font-size: 2rem;
font-weight: bold;
color: var(--pink);
}
.switches label {
display: flex;
align-items: center;
justify-content: space-between;
padding: 15px;
}
.switches span:last-child {
position: relative;
width: 50px;
height: 26px;
border-radius: 15px;
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.4);
background: var(--gray);
transition: all 0.3s;
}
.switches span:last-child::before,
.switches span:last-child::after {
content: "";
position: absolute;
}
.switches span:last-child::before {
left: 1px;
top: 1px;
width: 24px;
height: 24px;
background: var(--white);
border-radius: 50%;
z-index: 1;
transition: transform 0.3s;
}
.switches span:last-child::after {
top: 50%;
right: 8px;
width: 12px;
height: 12px;
transform: translateY(-50%);
background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/162656/uncheck-switcher.svg);
background-size: 12px 12px;
}
.switches [type="checkbox"]:checked + label span:last-child {
background: var(--green);
}
.switches [type="checkbox"]:checked + label span:last-child::before {
transform: translateX(24px);
}
.switches [type="checkbox"]:checked + label span:last-child::after {
width: 14px;
height: 14px;
/*right: auto;*/
left: 8px;
background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/162656/checkmark-switcher.svg);
background-size: 14px 14px;
}
@media screen and (max-width: 600px) {
.switches li::before {
display: none;
}
}
/* FOOTER
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.page-footer {
font-size: 14px;
text-align: right;
margin-top: 20px;
padding-right: 20px;
}
.page-footer span {
color: var(--pink);
}
This Pen doesn't use any external JavaScript resources.