A Pen by Joshua Ward on CodePen.
Last active
July 5, 2022 15:40
-
-
Save MboaAbel/52136995945daf4516ea51162180c2a9 to your computer and use it in GitHub Desktop.
Slanted Hero
This file contains hidden or 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
header.header | |
.grid-container | |
.grid-x.align-middle | |
.cell.small-6.medium-1 | |
.header-logo | |
button.header-navOpen | |
span | |
span | |
span | |
h4 Reeko | |
.cell.small-1.medium-9 | |
nav.header-nav | |
button.header-navClose | |
span | |
span | |
a.header-navLink.is-active(href="") Home | |
a.header-navLink(href="") About | |
a.header-navLink(href="") Services | |
a.header-navLink(href="") Contact | |
.cell.small-5.medium-2 | |
.header-cta | |
a.header-ctaLink(href="") GitHub | |
section.hero | |
//- .copyright-year | |
.hero-title | |
h1 Try and Understand | |
h2 It really is that bad. | |
section.slant | |
.grid-container | |
.grid-x.grid-padding-x | |
.cell.medium-4 | |
.card | |
i.fas.fa-glass-cheers | |
h3 It won't just go away | |
h4 the party's over | |
button.card-button Learn More | |
.cell.medium-4 | |
.card | |
i.fas.fa-clock | |
h3 It's past two o'clock | |
h4 so it's about time we stopped | |
button.card-button Learn More | |
.cell.medium-4 | |
.card | |
i.fas.fa-beer | |
h3 'Cause I See | |
h4 the keg has been sucked dry | |
button.card-button Learn More | |
section | |
.grid-container | |
.grid-x | |
.cell | |
p Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus. |
This file contains hidden or 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
// $(".copyright-year").length >= 1 && $(".copyright-year").html("").append((new Date).getFullYear()); | |
const openButton = document.querySelector('.header-navOpen'); | |
const closeButton = document.querySelector('.header-navClose'); | |
const navigation = document.querySelector('.header-nav'); | |
openButton.addEventListener('click', () => { | |
navigation.classList.add('is-open'); | |
}); | |
closeButton.addEventListener('click', () => { | |
navigation.classList.remove('is-open'); | |
}); | |
const header = document.querySelector('.header'); | |
const sticky = navigation.offsetTop; | |
window.addEventListener('scroll', () => { | |
if(window.scrollY > sticky) { | |
header.classList.add('sticky'); | |
} else { | |
header.classList.remove('sticky'); | |
} | |
}); |
This file contains hidden or 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
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> |
This file contains hidden or 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
// timing | |
$base-duration: 250ms; | |
// Colors | |
$primary: #f46d4c; | |
$accent: #e4505d; | |
$white: #fff; | |
$whitesmoke: whitesmoke; | |
$text: #555; | |
// Breakpoints | |
$sm: 0rem; | |
$med: 40rem; | |
$lg: 64rem; | |
$xlg: 75rem; | |
// sizes | |
$max-width: 1200px; | |
$spacer: 1rem; | |
// fonts / icons | |
$awesome: "Font Awesome 5 Free"; | |
$awesomeWeight: 900; | |
$roboto: 'Roboto', sans-serif; | |
$robotoSlab: 'Roboto Slab', serif; | |
*, | |
*:before, | |
*:after { | |
box-sizing: border-box; | |
outline: none; | |
} | |
html { | |
font-family: $roboto; | |
font-size: 16px; | |
font-smooth: auto; | |
font-weight: 300; | |
line-height: 1.5; | |
color: #444; | |
} | |
body { | |
position: relative; | |
// display: flex; | |
// align-items: center; | |
// justify-content: center; | |
// width: 100%; | |
// height: 100vh; | |
} | |
h1, h2, h3, h4, h5 { | |
font-family: $robotoSlab; | |
} | |
section { | |
padding-top: $spacer*3; | |
} | |
.header { | |
position: fixed; | |
width: 100%; | |
padding: $spacer 0; | |
background: transparent; | |
transition: 0.25s; | |
z-index: 9999; | |
&.sticky { | |
background: linear-gradient( | |
-45deg, | |
$primary 0, | |
$accent | |
); | |
box-shadow: 0 0 5px rgba(black,0.2) | |
} | |
&-logo { | |
position: relative; | |
display: flex; | |
align-items: center; | |
justify-content: flex-start; | |
h4 { | |
display: inline; | |
// align-items: center; | |
margin: 0; | |
color: $white; | |
line-height: 1; | |
// &:after { | |
// position: absolute; | |
// top: 50%; | |
// left: 80px; | |
// content: ''; | |
// width: 0.9375rem; | |
// height: 0.9375rem; | |
// background-color: $white; | |
// border-radius: 50%; | |
// transform: translateY(-50%); | |
// } | |
} | |
} | |
&-nav { | |
position: fixed; | |
top: 0; | |
left: -100%; | |
display: flex; | |
flex-direction: column; | |
justify-content: flex-start; | |
width: 90vw; | |
height: 100vh; | |
padding-top: $spacer*4; | |
background-color: rgba($accent,0.95); | |
transition: 0.25s; | |
z-index:0; | |
@media (min-width: $med) { | |
width: 40vw; | |
} | |
&.is-open { | |
left: 0%; | |
.header-navClose { | |
transform: scale(1); | |
opacity: 1; | |
visibility: visible; | |
} | |
} | |
&Open { | |
display: inline-flex; | |
flex-direction: column; | |
align-items: center; | |
justify-content: center; | |
width: 0.9375rem; | |
height: 0.8125rem; | |
margin-top: 0.125rem; | |
margin-right: $spacer*0.5; | |
border: 0; | |
background-color: transparent; | |
cursor: pointer; | |
span { | |
display: block; | |
width: 15px; | |
height: 2px; | |
background-color: $whitesmoke; | |
&:first-child { | |
transform: translateY(-3px); | |
} | |
&:last-child { | |
transform: translateY(3px); | |
} | |
} | |
} | |
&Close { | |
position: fixed; | |
top: 1.675rem; | |
left: $spacer; | |
width: 0.9375rem; | |
height: 0.8125rem; | |
// margin-top: -2px; | |
background-color: transparent; | |
border: 0; | |
transform: scale(0); | |
opacity: 0; | |
visibility: hidden; | |
transition: all 0.25s; | |
cursor: pointer; | |
@media (min-width: $med) { | |
left: $spacer*1.25; | |
} | |
span { | |
position: absolute; | |
top: 50%; | |
left: 0; | |
display: block; | |
width: 15px; | |
height: 2px; | |
background-color: $white; | |
&:first-child { | |
transform: rotate(45deg); | |
} | |
&:last-child { | |
transform: rotate(-45deg); | |
} | |
} | |
} | |
&Link { | |
position: relative; | |
padding: $spacer; | |
// | |
// margin: 0 10px; | |
// padding: 10px 0; | |
border-bottom: 1px solid rgba($white,0.5); | |
color: $white; | |
font-size: 0.875rem; | |
text-decoration: none; | |
&:after { | |
position: absolute; | |
content: ''; | |
bottom: 0; | |
left: 0; | |
width: 0%; | |
height: 1px; | |
background-color: $white; | |
transition: 0.25s linear; | |
} | |
&.is-active { | |
font-weight: bold; | |
} | |
&.is-active, | |
&:hover { | |
&:after { | |
width: 100%; | |
} | |
} | |
} | |
} | |
&-cta { | |
display: flex; | |
justify-content: flex-end; | |
&Link { | |
padding: 5px 20px; | |
border: 1px solid $white; | |
border-radius: 3px; | |
color: $white; | |
font-size: 0.875rem; | |
text-decoration: none; | |
} | |
} | |
} | |
.hero { | |
position: relative; | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
height: 45vh; | |
background: linear-gradient( | |
180deg, | |
$primary 0, | |
$accent | |
); | |
&-title { | |
margin-top: 5rem; | |
text-align: center; | |
h1, h2 { | |
margin: 0; | |
color: $white; | |
} | |
h2 { | |
font-weight: 300; | |
} | |
} | |
} | |
.slant { | |
position: relative; | |
display: block; | |
padding-bottom: 30px; | |
background-color: $white; | |
@media (min-width: 768px) { | |
padding-top: 0 !important; | |
&:before { | |
content: ""; | |
display: block; | |
height: 200px; | |
margin-bottom: 50px; | |
background: linear-gradient( | |
to right bottom, | |
$accent 49.9%, | |
transparent 50.1% | |
); | |
} | |
} | |
} | |
.card { | |
position: relative; | |
display: flex; | |
flex-direction: column; | |
align-items: center; | |
justify-content: space-between; | |
margin-bottom: $spacer*2; | |
padding: $spacer*2; | |
background-color: $whitesmoke; | |
//border: 1px solid $primary; | |
border-radius: $spacer*0.5; | |
// box-shadow: 0 0 5px rgba(black,0.2); | |
text-align: center; | |
@media (min-width: $med) { | |
height: 100%; | |
} | |
h3 { | |
margin-bottom: 0; | |
} | |
h4 { | |
margin-top: 0; | |
margin-bottom: $spacer*1.75; | |
font-weight: 300; | |
} | |
i { | |
color: $primary; | |
font-size: 3.5rem; | |
} | |
&-button { | |
position: relative; | |
display: inline-block; | |
width: auto; | |
padding: $spacer*0.75 $spacer*2; | |
background-color: $primary; | |
border: 0; | |
border-radius: $spacer*0.25; | |
color: $white; | |
font-family: $roboto; | |
font-size: 0.75rem; | |
text-transform: uppercase; | |
} | |
} | |
// grid shtuff | |
.grid-container { | |
max-width: $max-width; | |
margin: 0 auto; | |
padding: 0 $spacer; | |
@media (min-width: $med) { | |
padding: 0 $spacer*1.25; | |
} | |
&.full { | |
width: 100%; | |
padding: 0 !important; | |
} | |
.grid-x { | |
position: relative; | |
display: flex; | |
flex-wrap: wrap; | |
width: 100%; | |
@media (min-width: $sm) { | |
} | |
@media (min-width: $med) { | |
flex-direction: row; | |
//flex-wrap: wrap; | |
} | |
&.align-left { | |
justify-content: flex-start; | |
} | |
&.align-right { | |
justify-content: flex-end; | |
} | |
&.align-justify { | |
justify-content: space-between; | |
} | |
&.align-top { | |
align-items: flex-start; | |
} | |
&.align-bottom { | |
align-items: flex-end; | |
} | |
&.align-middle { | |
align-items: center; | |
} | |
&.align-center { | |
align-items: center; | |
justify-content: center; | |
} | |
&.align-stretch { | |
align-items: stretch; | |
} | |
&.grid-margin-x { | |
.cell { | |
margin-left: 10px; | |
margin-right: 10px; | |
} | |
} | |
&.grid-padding-x { | |
.cell { | |
padding-left: 10px; | |
padding-right: 10px; | |
} | |
} | |
&.grid-margin-y { | |
.cell { | |
margin-top: 10px; | |
margin-bottom: 10px; | |
} | |
} | |
&.grid-padding-y { | |
.cell { | |
padding-top: 10px; | |
padding-bottom: 10px; | |
} | |
} | |
} | |
} | |
.cell { | |
display: block; | |
width: 100%; | |
&.auto { | |
flex: 0 0 auto; | |
width: auto; | |
} | |
&.grow { | |
flex: 1 0 auto; | |
width: auto; | |
} | |
&.shrink { | |
flex: 0 1 auto; | |
width: auto; | |
} | |
&.small-1 { | |
@media (min-width: $sm) { | |
width: 8.3333%; | |
} | |
} | |
&.small-2 { | |
@media (min-width: $sm) { | |
width: 16.6666%; | |
} | |
} | |
&.small-3 { | |
@media (min-width: $sm) { | |
width: 25%; | |
} | |
} | |
&.small-4 { | |
@media (min-width: $sm) { | |
width: 33.3333%; | |
} | |
} | |
&.small-5 { | |
@media (min-width: $sm) { | |
width: 41.6666%; | |
} | |
} | |
&.small-6 { | |
@media (min-width: $sm) { | |
width: 50%; | |
} | |
} | |
&.small-7 { | |
@media (min-width: $sm) { | |
width: 58.3333%; | |
} | |
} | |
&.small-8 { | |
@media (min-width: $sm) { | |
width: 66.6666%; | |
} | |
} | |
&.small-9 { | |
@media (min-width: $sm) { | |
width: 75%; | |
} | |
} | |
&.small-10 { | |
@media (min-width: $sm) { | |
width: 83.3333%; | |
} | |
} | |
&.small-11 { | |
@media (min-width: $sm) { | |
width: 91.666612%; | |
} | |
} | |
&.medium-1 { | |
@media (min-width: $med) { | |
width: 8.3333%; | |
} | |
} | |
&.medium-2 { | |
@media (min-width: $med) { | |
width: 16.6666%; | |
} | |
} | |
&.medium-3 { | |
@media (min-width: $med) { | |
width: 25%; | |
} | |
} | |
&.medium-4 { | |
@media (min-width: $med) { | |
width: 33.3333%; | |
} | |
} | |
&.medium-5 { | |
@media (min-width: $med) { | |
width: 41.6666%; | |
} | |
} | |
&.medium-6 { | |
@media (min-width: $med) { | |
width: 50%; | |
} | |
} | |
&.medium-7 { | |
@media (min-width: $med) { | |
width: 58.3333%; | |
} | |
} | |
&.medium-8 { | |
@media (min-width: $med) { | |
width: 66.6666%; | |
} | |
} | |
&.medium-9 { | |
@media (min-width: $med) { | |
width: 75%; | |
} | |
} | |
&.medium-10 { | |
@media (min-width: $med) { | |
width: 83.3333%; | |
} | |
} | |
&.medium-11 { | |
@media (min-width: $med) { | |
width: 91.666612%; | |
} | |
} | |
&.large-1 { | |
@media (min-width: $lg) { | |
width: 8.3333%; | |
} | |
} | |
&.large-2 { | |
@media (min-width: $lg) { | |
width: 16.6666%; | |
} | |
} | |
&.large-3 { | |
@media (min-width: $lg) { | |
width: 25%; | |
} | |
} | |
&.large-4 { | |
@media (min-width: $lg) { | |
width: 33.3333%; | |
} | |
} | |
&.large-5 { | |
@media (min-width: $lg) { | |
width: 41.6666%; | |
} | |
} | |
&.large-6 { | |
@media (min-width: $lg) { | |
width: 50%; | |
} | |
} | |
&.large-7 { | |
@media (min-width: $lg) { | |
width: 58.3333%; | |
} | |
} | |
&.large-8 { | |
@media (min-width: $lg) { | |
width: 66.6666%; | |
} | |
} | |
&.large-9 { | |
@media (min-width: $lg) { | |
width: 75%; | |
} | |
} | |
&.large-10 { | |
@media (min-width: $lg) { | |
width: 83.3333%; | |
} | |
} | |
&.large-11 { | |
@media (min-width: $lg) { | |
width: 91.666612%; | |
} | |
} | |
&.align-self-right { | |
display: flex; | |
justify-content: flex-end; | |
} | |
&.align-self-left { | |
display: flex; | |
justify-content: flex-start; | |
} | |
} |
This file contains hidden or 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
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css" rel="stylesheet" /> | |
<link href="https://fonts.googleapis.com/css?family=Roboto+Slab:300,400,700|Roboto:300,400,700&display=swap" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment