A Pen by timdonovanuk on CodePen.
Created
April 18, 2020 07:15
-
-
Save timdonovanuk/a72372dfae3647c6544a251c02641c7c to your computer and use it in GitHub Desktop.
WKND - Offer Component
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
<div class="cmp-offer__block"> | |
<div class="cmp-offer" style="background: url('https://blogsimages.adobe.com/creativecloud/files/2016/07/Fotolia_112862884_S.jpg'); background-size: cover;"> | |
<div class="cmp-offer__overlay"> | |
<div class="cmp-offer__items"></div> | |
<div class="cmp-offer__items cmp-offer__head"> | |
<p>Sale on trips to Brazil</p> | |
<hr> | |
</div> | |
<div class="cmp-offer__items cmp-offer__price"> | |
<p class="cmp-offer__old">£2099</p> | |
<p class="cmp-offer__new">£1045</p> | |
</div> | |
<div class="cmp-offer__items cmp-offer__cart"> | |
<span>@ Contact Us!</span> | |
</div> | |
</div> | |
</div> | |
<div class="cmp-offer" style="background: url('https://blogsimages.adobe.com/creativecloud/files/2016/01/Fotolia_59960522_S.jpg'); background-size: cover;"> | |
<div class="cmp-offer__overlay"> | |
<div class="cmp-offer__items"></div> | |
<div class="cmp-offer__items cmp-offer__head"> | |
<p>Sale on trips to France</p> | |
<hr> | |
</div> | |
<div class="cmp-offer__items cmp-offer__price"> | |
<p class="cmp-offer__old">£699</p> | |
<p class="cmp-offer__new">£345</p> | |
</div> | |
<div class="cmp-offer__items cmp-offer__contact"> | |
<span>@ Contact Us!</span> | |
</div> | |
</div> | |
</div> | |
</div> |
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
.cmp-offer__block { | |
text-align: center; | |
} | |
.cmp-offer { | |
display: inline-block; | |
text-align: left; | |
width: 300px; | |
height: 400px; | |
top: 0; | |
right: 0; | |
left: 0; | |
bottom: 0; | |
margin: auto; | |
margin-left: 30px; | |
margin-top: 30px; | |
background-size: cover; | |
cursor: pointer; | |
} | |
.cmp-offer__overlay { | |
width: 100%; | |
height: 100%; | |
display: grid; | |
grid-template-columns: 1fr; | |
grid-template-rows: 1fr 2fr 2fr 1fr; | |
background: rgba(255, 234, 0, 0.9); | |
color: #202020; | |
opacity: 0; | |
transition: all 0.5s; | |
} | |
.cmp-offer__items { | |
padding-left: 20px; | |
letter-spacing: 3px; | |
} | |
.cmp-offer__head { | |
font-size: 30px; | |
line-height: 40px; | |
transform: translateY(40px); | |
transition: all 0.7s; | |
hr { | |
display: block; | |
width: 0; | |
border: none; | |
border-color: blue; | |
border-bottom: solid 2px red; | |
position: absolute; | |
bottom: 0; | |
left: 20px; | |
transition: all 0.5s; | |
} | |
} | |
.cmp-offer__price { | |
font-size: 22px; | |
line-height: 10px; | |
font-weight: bold; | |
opacity: 0; | |
transform: translateY(40px); | |
transition: all 0.7s; | |
.cmp-offer__old { | |
text-decoration: line-through; | |
color: lighten(rgb(77, 77, 77), 10%); | |
} | |
} | |
.cmp-offer__contact { | |
font-size: 18px; | |
opacity: 0; | |
letter-spacing: 1px; | |
transform: translateY(40px); | |
transition: all 0.7s; | |
} | |
.cmp-offer:hover .cmp-offer__overlay { | |
opacity: 1; | |
& .cmp-offer__head { | |
transform: translateY(0px); | |
} | |
& hr { | |
width: 75px; | |
transition-delay: 0.4s; | |
} | |
& .cmp-offer__price { | |
transform: translateY(0px); | |
transition-delay: 0.3s; | |
opacity: 1; | |
} | |
& .cmp-offer__contact { | |
transform: translateY(0px); | |
transition-delay: 0.6s; | |
opacity: 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment