Categories
Web development

How to change the CSS Gradient Background On Scroll?

CSS Gradient Background

Demo:

To create the CSS Gradient Background On Scroll follow the steps below and watch the video tutorial:

  1. Add HTML
  2. Add CSS

Step1.

Add HTML

<h2 style="position:fixed;">Scroll to see the effect.</h2>

Step2.

Add CSS

body {
  height: 5000px;
  justify-content: center;
  display: flex;
  background-image: linear-gradient(43deg, #4158D0 0%, #C850C0 46%, #FFCC70 100%);   
}

h2 {
  color: white;
  text-shadow: 1px 1px 1px black;
  left:45%;
}

Watch also the video tutorial:

Enjoy coding!

Hey, here’s something that might interest you:

CSS Background Change Animation – Day & Night

CSS Paper Plane Animation