스크롤 시 그라데이션 배경색을 생성하려면 코드는 다음과 같습니다. −
예시
<!DOCTYPE html>
<html>
<head>
<style>
body {
height: 250vh;
color: white;
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(
141deg,
#a47dff 0%,
#4e28a7 40%,
#22053d 65%,
#72a4ff 75%
);
}
</style>
</head>
<body>
<h1>Change Background Gradient on Scroll Example</h1>
<p style="font-size: 30px;">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Repellendus, laborum minus? Vero accusantium laborum quas cum, sed obcaecati quibusdam dignissimos.
</p>
<h2 style="position:fixed;">Scroll to see the effect.</h2>
</body>
</html> 출력
위의 코드는 다음과 같은 출력을 생성합니다 -

스크롤하는 동안 그라디언트가 진한 파란색에서 밝은 파란색으로 이동합니다 -
