Last active
September 25, 2020 11:26
-
-
Save wpflames/9c8302ec036011149698e1a6b82f0ffb to your computer and use it in GitHub Desktop.
Responsive Website with Smooth Scroll Navigation
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
| $dark: #0d1113; | |
| $red: linear-gradient(to right, #7a2629, #440b0c); | |
| *{ | |
| margin: 0; | |
| padding: 0; | |
| box-sizing: border-box; | |
| font-family: 'Poppins', sans-serif; | |
| scroll-behavior: smooth; | |
| } | |
| header{ | |
| position: fixed; | |
| width: 100%; | |
| height: 80px; | |
| padding: 0 50px; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| background: $dark; | |
| z-index: 1000; | |
| a{ | |
| color: white; | |
| text-decoration: none; | |
| &.logo{ | |
| font-weight: bold; | |
| font-size: 1.4rem; | |
| } | |
| } | |
| nav{ | |
| ul{ | |
| display: flex; | |
| position: relative; | |
| li{ | |
| list-style: none; | |
| margin: 0 10px; | |
| a{ | |
| position: relative; | |
| padding: 5px 10px; | |
| display: inline-block; | |
| cursor: pointer; | |
| transition: .5s; | |
| &:hover, &.active{ | |
| background: $red; | |
| border-radius: 5px; | |
| } | |
| } | |
| } | |
| } | |
| #toggle{ | |
| display: none; | |
| } | |
| } | |
| } | |
| //COVER | |
| #home.cover{ | |
| position: relative; | |
| h2{ | |
| span{ | |
| display: block; | |
| text-transform: none; | |
| font-size: 4.5rem; | |
| color: #742326; | |
| } | |
| } | |
| img{ | |
| position: relative; | |
| z-index: 2; | |
| } | |
| .shape{ | |
| position: absolute; | |
| top: 0; | |
| right: 0; | |
| background: $dark; | |
| width: 265px; | |
| height: 100%; | |
| z-index: 1; | |
| } | |
| .social{ | |
| position: absolute; | |
| right: 46px; | |
| ul{ | |
| li{ | |
| list-style: none; | |
| a{ | |
| background: none; | |
| } | |
| } | |
| } | |
| } | |
| } | |
| //SECTIONS | |
| section{ | |
| position: relative; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| min-height: 100vh; | |
| padding: 150px 100px 100px; | |
| img{ | |
| max-width: 340px; | |
| margin-left: 30px; | |
| } | |
| h2{ | |
| font-size: 2.5rem; | |
| text-transform: uppercase; | |
| margin-bottom: 30px; | |
| } | |
| p{ | |
| font-size: 1.2rem; | |
| margin-bottom: 30px; | |
| } | |
| a{ | |
| display: inline-block; | |
| padding: 8px 10px; | |
| text-decoration: none; | |
| font-size: 1.2rem; | |
| background: $red; | |
| color: white; | |
| margin-bottom: 30px; | |
| border-radius: 5px; | |
| } | |
| &:nth-child(even){ | |
| position: relative; | |
| justify-content: center; | |
| align-items: center; | |
| background: $dark; | |
| color: white; | |
| } | |
| } | |
| @media (max-width: 992px){ | |
| header{ | |
| nav{ | |
| ul{ | |
| position: absolute; | |
| top: -100%; | |
| left: 0; | |
| width: 100%; | |
| height: calc(100vh - 80px); | |
| padding: 50px 100px; | |
| text-align: center; | |
| overflow: auto; | |
| transition: .5s; | |
| background: black; | |
| flex-direction: column; | |
| transform: translateY(-100%); | |
| li{ | |
| font-size: 1.8rem; | |
| margin: 10px 0; | |
| } | |
| } | |
| #toggle{ | |
| display: block; | |
| position: relative; | |
| width: 30px; | |
| height: 30px; | |
| cursor: pointer; | |
| &:before{ | |
| content: ''; | |
| position: absolute; | |
| top: 4px; | |
| width: 100%; | |
| height: 2px; | |
| background: white; | |
| z-index: 1; | |
| box-shadow: 0 10px 0 white; | |
| transition: .5s; | |
| } | |
| //toggle | |
| &:after{ | |
| content: ''; | |
| position: absolute; | |
| bottom: 4px; | |
| width: 100%; | |
| height: 2px; | |
| background: white; | |
| z-index: 1; | |
| transition: .5s; | |
| } | |
| } | |
| } | |
| //header | |
| &.active{ | |
| nav{ | |
| #toggle:before{ | |
| top: 14px; | |
| transform: rotate(45deg); | |
| box-shadow: none; | |
| } | |
| #toggle:after{ | |
| top: 14px; | |
| transform: rotate(-45deg); | |
| box-shadow: 0 0 0 white; | |
| } | |
| ul{ | |
| transform: translateY(0); | |
| top: 80px; | |
| } | |
| } | |
| } | |
| } | |
| section{ | |
| padding: 100px 50px 50px; | |
| flex-direction: column; | |
| justify-content: center; | |
| align-items: center; | |
| img{ | |
| margin: 50px 0 0; | |
| max-width: 100%; | |
| } | |
| } | |
| #home.cover{ | |
| .shape{ | |
| display: none; | |
| } | |
| h2 { | |
| font-size: 2rem; | |
| text-transform: uppercase; | |
| margin-bottom: 30px; | |
| line-height: 1.3; | |
| span { | |
| font-size: 3rem; | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment