<section class="newsletter">
<h3 class="newsletter-header">Sign up to our newsletter below.</h3>
<form class="newsletter-form">
<fieldset>
<input type="email" class="newsletter-email" placeholder="you@me.com">
<button type="submit" class="newsletter-submit"><span>Go</span></button>
</fieldset>
<fieldset>
<input type="checkbox" class="newsletter-checkbox" id="newsletter-offers" name="newsletter-offers" checked>
<label class="newsletter-label" for="newsletter-offers">
Notify me with special offers
<figure class="newsletter-check">
<svg class="checkmark" width="56" height="56">
<path d="m25,36 l14,-16"
style="stroke-dasharray: 27px;"></path>
<path d="m25,36 l-8,-9"
style="stroke-dasharray: 11px;"></path>
</svg>
<svg class="cross" width="56" height="56">
<path d="m28,28 l-8,-8"
style="stroke-dasharray: 13px;"></path>
<path d="m28,28 l8,8"
style="stroke-dasharray: 13px;"></path>
<path d="m28,28 l-8,8"
style="stroke-dasharray: 13px;"></path>
<path d="m28,28 l8,-8"
style="stroke-dasharray: 13px;"></path>
</svg>
</figure>
</label>
</fieldset>
</form>
</section>
/* Mixins */
@mixin linear-gradient( $start: #f1f1f1, $from: 0%, $stop: #d9d9d9, $to: 100% ) {
background: $start;
background: linear-gradient(to bottom, $start $from,$stop $to);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#{ie-hex-str($start)}', endColorstr='#{ie-hex-str($stop)}',GradientType=0 );
}
@mixin shadows($text: false, $top: #000000, $bottom: #ffffff, $weight: 1px, $blur: 0px) {
@if $text == true {
text-shadow: 0 -1px $blur rgba($top, .3), 0 $weight $blur rgba($bottom, .2);
}
@else {
box-shadow: inset 0 $weight $blur rgba($top, .1), 0 $weight $blur rgba($bottom, .2);
}
}
/* Colors */
$white: #ffffff;
$offwhite: #e9e9e9;
$lightgreen: #99c740;
$darkgreen: #7ba132;
$radius: 50px;
body {
background: $lightgreen;
margin-bottom: 5em;
font-weight: 700;
letter-spacing: -1px;
}
.newsletter {
max-width: 500px;
margin: 0 auto;
}
.newsletter-header {
margin-top: 3em;
margin-bottom: 4em;
color: $white;
font-size: 2.1em;
text-align: center;
text-shadow: 0 2px 0 $darkgreen;
}
.newsletter-email {
background: $darkgreen;
border: none;
border-radius: $radius;
padding: .65em 4em .65em 1em;
width: 100%;
color: $white;
font-size: 2em;
letter-spacing: -1px;
@include shadows($weight: 2px);
transition: background .2s;
&:hover,
&:focus {
background: lighten($darkgreen, 2%);
}
}
.newsletter-submit {
position: absolute;
top: 3px; right: 3px;
height: calc(100% - 6px);
padding: 1.15em 1.35em;
border: 0;
border-radius: $radius;
color: $darkgreen;
font-size: 1.5em;
line-height: .5;
box-shadow: 0 5px 20px rgba(0,0,0, .3);
@include linear-gradient($white, 0%, $offwhite, 100%);
span {
padding: .1em .65em;
border-radius: $radius;
@include linear-gradient($offwhite, 0%, $white, 100%);
}
}
.newsletter-checkbox {display:none;}
.newsletter-label {
@include shadows($text: true, $weight: 2px);
display: block;
margin-top: 3em;
position: relative;
cursor: pointer;
color: $darkgreen;
font-size: 1.5em;
svg {
position: absolute;
top: 3px;
opacity: 0;
transition: all .2s;
&.checkmark {
left: 0;
opacity: 0;
}
&.cross {
right: 0;
opacity: 1;
}
}
path {
stroke: #fff;
stroke-linecap: round;
stroke-width: 4;
transition: opacity 0.1s;
transition: opacity 0.1s;
fill: none;
transition: stroke-dashoffset 0.2s;
transition: stroke-dashoffset 0.2s;
}
}
.newsletter-check {
position: absolute;
top: -.5em;
right: 0;
margin: 0;
padding: 1em;
width: 4.75em;
height: 2.5em;
appearance: none;
appearance: none;
background: $darkgreen;
border-radius: $radius;
outline: none;
cursor: pointer;
transition: transform .2s, background .3s;
@include shadows($weight: 2px);
&:before,
&:after {
content: '';
position: absolute;
transition: all .2s;
}
&:before {
height: calc(100% - 6px);
width: 2.3em;
top: 3px; left: 3px;
border-radius: 50%;
box-shadow: 0 5px 20px rgba(0,0,0, .3);
@include linear-gradient($white, 0%, $offwhite, 80%);
}
&:after {
top: calc(50% - .4em);
left: calc(1.1em - 6px);
height: .8em;
width: .8em;
border-radius: 50%;
@include linear-gradient($offwhite, 30%, $white, 100%);
}
}
.newsletter-checkbox:checked + label {
.checkmark { opacity: 1; }
.cross { opacity: 0; }
}
.newsletter-checkbox:checked + label .newsletter-check:before {
transform: translateX( calc(100% - 2px) );
}
.newsletter-checkbox:checked + label .newsletter-check:after {
transform: translateX( calc(100% + (1.1em + 8px)) );
}
/* Extras */
*, *:before, *:after {
font-smoothing: antialiased;
text-rendering: optimizeLegibility;
box-sizing: border-box;
box-sizing: border-box;
box-sizing: border-box;
}
fieldset {
border: 0;
padding: 0;
position: relative;
width: 100%;
}
input:focus {
outline: none;
}
::input-placeholder {
color: $white;
}
xxxxxxxxxx