Created
March 14, 2022 20:04
-
-
Save perezdans/744bb9807ab3d21a7c24f013c450cc45 to your computer and use it in GitHub Desktop.
Crear una lista de tarea con checkbox con css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<title>CSS Tricks & Tips</title> | |
<meta charset="UTF-8" /> | |
<style> | |
.checklist { | |
padding: 50px; | |
position: relative; | |
background: #043b3e; | |
border-top: 50px solid #03a2f4; | |
} | |
.checklist h2 { | |
color: #f3f3f3; | |
font-size: 25px; | |
padding: 10px 0; | |
margin-left: 10px; | |
display: inline-block; | |
border-bottom: 4px solid #f3f3f3; | |
} | |
.checklist label { | |
position: relative; | |
display: block; | |
margin: 40px 0; | |
color: #fff; | |
font-size: 24px; | |
cursor: pointer; | |
} | |
.checklist input[type="checkbox"] { | |
-webkit-appearance: none; | |
} | |
.checklist i { | |
position: absolute; | |
top: 2px; | |
display: inline-block; | |
width: 25px; | |
height: 25px; | |
border: 2px solid #fff; | |
} | |
.checklist input[type="checkbox"]:checked ~ i { | |
top: 1px; | |
height: 15px; | |
width: 25px; | |
border-top: none; | |
border-right: none; | |
transform: rotate(-45deg); | |
} | |
.checklist span { | |
position: relative; | |
left: 40px; | |
transition: 0.5s; | |
} | |
.checklist span:before { | |
content: ''; | |
position: absolute; | |
top: 50%; | |
left: 0; | |
width: 100%; | |
height: 1px; | |
background: #fff; | |
transform: translateY(-50%) scaleX(0); | |
transform-origin: left; | |
transition: transform 0.5s; | |
} | |
.checklist input[type="checkbox"]:checked ~ span:before { | |
transform: translateY(-50%) scaleX(1); | |
transform-origin: right; | |
transition: transform 0.5s; | |
} | |
.checklist input[type="checkbox"]:checked ~ span { | |
color: #154e6b; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="checklist"> | |
<h2>Item Checklist with CSS</h2> | |
<label> | |
<input type="checkbox" name="" id="" /> | |
<i></i> | |
<span>Item #1</span> | |
</label> | |
<label> | |
<input type="checkbox" name="" id="" /> | |
<i></i> | |
<span>Item #2</span> | |
</label> | |
<label> | |
<input type="checkbox" name="" id="" /> | |
<i></i> | |
<span>Item #3</span> | |
</label> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment