Parallex scrolling effect with only css.
Created
August 20, 2020 17:39
-
-
Save CarlasHub/16745b2f503df94b9daac01f2799917c to your computer and use it in GitHub Desktop.
Parallax CSS
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
<div class="parallax"> | |
<h1>Parallax Effect</h1> | |
</div> | |
<div class="parallax p-2"> | |
<h1>I’m at a place in my life when errands are starting to count as going out.</h1> | |
</div> | |
<div class="parallax p-3"> | |
<h1>I don’t believe in astrology;<br> I’m a Sagittarius and we’re skeptical.</h1> | |
</div> |
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
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700;900&display=swap'); | |
body { | |
margin: 0; | |
padding: 0; | |
font-family: 'Roboto', sans-serif; | |
} | |
.parallax { | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
text-align: center; | |
height: 100vh; | |
width: 100%; | |
background-image: linear-gradient(rgba(0,0,0,.4), rgba(0,0,0,.4)), url(https://images.unsplash.com/photo-1480497490787-505ec076689f?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1349&q=80); | |
background-repeat: no-repeat; | |
background-size: cover; | |
background-attachment: fixed; | |
color: #fff; | |
} | |
.p-2 { | |
background-image: linear-gradient(rgba(0,0,0,.4), rgba(0,0,0,.4)), url(https://images.unsplash.com/photo-1549880181-56a44cf4a9a5?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80); | |
} | |
.p-3 { | |
background-image: linear-gradient(rgba(0,0,0,.4), rgba(0,0,0,.4)), url(https://images.unsplash.com/photo-1474401915596-3c5adf84ef01?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment