I wan’t to make the h1 text move up vertically while scrolling simultaneously it will be changing font size from 300 to 50. I have got the 2nd part (size changing) of the code working but can’t figure out how to make the text move up vertically while scrolling.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>NBA</title>
<link rel="icon" sizes="1800x1800" href="Images/logo.png">
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div class="container">
<div class="heading">
<h1>NBA</h1>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
2
Answers
In your CSS file, create a keyframe animation for the "scroll-text" class. eg:
then add the animation to the "scroll-text" class, with a desired duration and timing function:
you can also use the scroll-behavior property to make the text scroll smoothly.