Created
August 29, 2020 17:17
-
-
Save hsh2001/d70531e7843a7fba62260caf1d34de72 to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Sticky!</title> | |
<style> | |
* { | |
margin: 0; | |
} | |
section { | |
height: 100vh; | |
} | |
.sticky { | |
position: sticky; | |
top: calc(50vh - 0.5rem); | |
left: 30vw; | |
} | |
</style> | |
</head> | |
<body> | |
<section><h1>hello world</h1></section> | |
<section><h1 class="sticky">hello world</h1></section> | |
<section>Bye world</section> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment