Created
May 21, 2025 16:01
-
-
Save IliaLiashenko/488af1589aef5f6cc9003463b78e7e40 to your computer and use it in GitHub Desktop.
Parallax html/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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title></title> | |
<link rel="stylesheet" type="text/css" href="style.css"> | |
</head> | |
<body> | |
<div class="container"> | |
<section class="bg-1"> | |
<h2>Section 1</h2> | |
</section> | |
<section class="bg-2"> | |
<h2>Section 2</h2> | |
</section> | |
<section class="bg-3"> | |
<h2>Section 3</h2> | |
</section> | |
<section class="bg-4"> | |
<h2>Section 4</h2> | |
</section> | |
</div> | |
<script type="text/javascript" src="script.js"></script> | |
</body> | |
</html> |
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
* { | |
margin: 0; | |
padding: 0; | |
box-sizing: border-box; | |
} | |
section{ | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
font-size: 8vw; | |
background-position: no-repeat; | |
background-size: cover; | |
background-attachment: fixed; | |
width: 100%; | |
} | |
.bg-1{ | |
background-image: url(img/bg1.jpg); | |
height: 100vh; | |
} | |
.bg-2{ | |
background: #fff; | |
height: 100vh; | |
} | |
.bg-3{ | |
background-image: url(img/bg3.jpg); | |
height: 100vh; | |
} | |
.bg-4{ | |
background-image: url(img/bg4.jpg); | |
height: 100vh; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment