checkbox animations

This commit is contained in:
TreetopFlyer 2021-09-10 13:22:19 -04:00
parent 6bb91f3985
commit f3166e7651

View File

@ -9,7 +9,7 @@
align-items: flex-start; align-items: flex-start;
margin: 0; margin: 0;
padding: 0; padding: 12px 20px;
border: 0; border: 0;
border-radius: 5px; border-radius: 5px;
@ -32,22 +32,24 @@
border:1px solid #ddd; border:1px solid #ddd;
} }
input[type='radio'] input[type='radio']
{ {
appearance: none; appearance: none;
display:block; display:block;
position:relative;
margin:0; margin:0;
padding:0; padding:0;
border:0; border:0;
width:0; width:0;
height:0; height:0;
} }
input[type='radio'] + .block label input[type='radio'] + * label
{ {
position: relative; position: relative;
padding-left:50px; padding-left:50px;
} }
input[type='radio'] + .block label::before input[type='radio'] + * label::before, input[type='radio'] + * label::after
{ {
content: " "; content: " ";
display: block; display: block;
@ -56,46 +58,105 @@
left: 10px; left: 10px;
width: 17px; width: 17px;
height: 17px; height: 17px;
border: 2px solid #000; border: 2px solid #D2D2D1;
border-radius: 20px; border-radius: 20px;
} }
input[type='radio']:checked + .block label::after input[type='radio']:checked + * label::before
{
border:2px solid #1565C0;
}
input[type='radio'] + * label::after
{
background:#1565C0;
border:2px solid #1565C0;
opacity:0;
transform:scale(1);
transition: opacity 0.4s, transform 0.4s;
}
input[type='radio']:checked + * label::after
{
opacity:1;
transform:scale(0.65);
}
input[type='radio']:checked + *
{
background: #F8F8F6;
}
input[type='checkbox']
{
appearance: none;
display:block;
position: relative;
margin:0;
padding:0;
border:0;
width:0;
height:0;
}
input[type='checkbox'] + label
{
padding-left:30px;
}
input[type='checkbox']::before
{
content:" ";
display:block;
box-sizing: border-box;
width:22px;
height:22px;
border:2px solid #aaa;
border-radius:3px;
background:#ccc;
}
input[type='checkbox']:checked::before
{
border:2px solid #0A58B2;
background:#1565C0;
}
input[type='checkbox']::after
{ {
content: " "; content: " ";
display: block; display: block;
position: absolute; position: absolute;
width: 11px; width: 10px;
height: 11px; height: 5px;
top: 15px; border-bottom: 3px solid #fff;
left: 15px; border-left: 3px solid #fff;
border-radius: 20px; transform: rotate(-45deg);
background: #000; left: 5px;
top: 10px;
opacity:0;
transition:opacity 0.4s, top 0.4s;
} }
input[type='radio']:checked + .block input[type='checkbox']:checked::after
{ {
background:yellow; opacity:1;
top: 5px;
} }
</style> </style>
<style> <style>
@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@200;300;600;900&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@200;300;600;900&display=swap');
.text--size-micro{ font-size: 12px; line-height:24px; } .txt--size-micro{ font-size: 12px; line-height:24px; }
.text--size-small{ font-size: 14px; line-height:24px; } .txt--size-small{ font-size: 14px; line-height:24px; }
.text--size-copy{ font-size:16px; line-height:24px; } .txt--size-copy{ font-size:16px; line-height:24px; }
.text--size-h2{ font-size:24px; line-height:28px; } .txt--size-h2{ font-size:24px; line-height:28px; }
.text--size-h1{ font-size:32px; line-height:48px; } .txt--size-h1{ font-size:32px; line-height:48px; }
.text--green-darken-01{ color: #4B6451; } .txt--green-darken-01{ color: #4B6451; }
.text--weight-light{ font-family:"Nunito Sans"; font-weight:100; } .txt--wgt-light{ font-family:"Nunito Sans"; font-weight:100; }
.text--weight-normal{ font-family:"Nunito Sans"; font-weight:300; } .txt--wgt-normal{ font-family:"Nunito Sans"; font-weight:300; }
.text--weight-bold{ font-family:"Nunito Sans"; font-weight:600; } .txt--wgt-bold{ font-family:"Nunito Sans"; font-weight:600; }
.text--weight-black{ font-family:"Nunito Sans"; font-weight:900; } .txt--wgt-black{ font-family:"Nunito Sans"; font-weight:900; }
.text--uppercase{ text-transform: uppercase; } .txt--uppercase{ text-transform: uppercase; }
.gap--lg { margin:72px 0 0 0; } .gap--lg { margin:72px 0 0 0; }
.gap--md { margin:47px 0 0 0; } .gap--md { margin:47px 0 0 0; }
@ -107,22 +168,27 @@
<body> <body>
<form> <form>
<div class="text--size-h2 text--weight-black gap--reset gap--lg">Review Your Order</div> <input type="checkbox" id="bool-1"/>
<div class="text--size-copy text--weight-black text--uppercase gap--sm">Payment Method</div> <label for="bool-1">
Please send me the daily devotional and program link from Truth For Life with Alistair Begg.
</label>
<div class="txt--size-h2 txt--wgt-black gap--lg">Review Your Order</div>
<div class="txt--size-copy txt--wgt-black txt--uppercase gap--sm">Payment Method</div>
<div class="block block--bordered gap--xs"> <div class="block block--bordered gap--xs">
<div class="text--size-copy text--weight-bold">Credit Card</div> <div class="txt--size-copy txt--wgt-bold">Credit Card</div>
<a class="text--green-darken-01" href="/">Change</a> <a class="txt--green-darken-01" href="/">Change</a>
</div> </div>
<input id="check-1" type="radio" name="slot-1" value="option-1"/> <input id="check-1" type="radio" name="slot-1" value="option-1"/>
<div class="block"> <div class="block">
<label class="block__hit-area" for="check-1"> <label class="block__hit-area" for="check-1">
<span class="text--size-copy text--weight-bold">Credit Card</strong><br> <span class="txt--size-copy txt--wgt-bold">Credit Card</strong><br>
<span class="text--size-copy text--weight-normal">Credit Card</span><br> <span class="txt--size-copy txt--wgt-normal">Credit Card</span><br>
<span class="text--size-copy text--weight-normal">Credit Card</span><br> <span class="txt--size-copy txt--wgt-normal">Credit Card</span><br>
<span class="text--size-copy text--weight-normal">Credit Card</span><br> <span class="txt--size-copy txt--wgt-normal">Credit Card</span><br>
<span class="text--size-copy text--weight-normal">Credit Card</span> <span class="txt--size-copy txt--wgt-normal">Credit Card</span>
</label> </label>
<a class="block__auxillary" href="/">Change</a> <a class="block__auxillary" href="/">Change</a>
</div> </div>
@ -136,17 +202,17 @@
<a class="block__auxillary" href="/">Change</a> <a class="block__auxillary" href="/">Change</a>
</div> </div>
<div class="text--size-h2 text--weight-black">Shipping Information</div> <div class="txt--size-h2 txt--wgt-black">Shipping Information</div>
<div class="text--size-copy text--weight-black text--uppercase">Shipping Information</div> <div class="txt--size-copy txt--wgt-black txt--uppercase">Shipping Information</div>
<div class="block block--bordered"> <div class="block block--bordered">
<div class="block__hit-area"> <div class="block__hit-area">
<div class="text--size-copy text--weight-bold">Shell Long TP Check</div> <div class="txt--size-copy txt--wgt-bold">Shell Long TP Check</div>
<div class="text--size-copy text--weight-normal"> <div class="txt--size-copy txt--wgt-normal">
8759 Cardinal Court<br> 8759 Cardinal Court<br>
Windmere, FL 34786<br> Windmere, FL 34786<br>
US US
</div> </div>
<div class="text--size-copy text--weight-normal"> <div class="txt--size-copy txt--wgt-normal">
8759 Cardinal Court<br> 8759 Cardinal Court<br>
Windmere, FL 34786<br> Windmere, FL 34786<br>
US US