Jump to content

Gradient Background using CSS

Go to solution Solved by tuanphan,

Recommended Posts

Posted

Using the following code, I want to create a gradient background on my site using the following code. However, when inputting this into CSS it has no effect. 

section, section .content-wrapper, section .section-background {
    background: transparent !important;
}

#siteWrapper {
    background: linear-gradient(to bottom, #4B86B9, #B2B1BF, #F16351);
    background-size: 600% 100%;
    animation: gradient 16s linear infinite;
    animation-direction: alternate;
}

@keyframes gradient {
    0% {
        background-position: 0%;
    }
    100% {
        background-position: 100%;
    }
}

 

Any advice at all would be greatly appreciated as I am new to code. 

 

Thanks 

  • Replies 6
  • Views 1.5k
  • Created
  • Last Reply

Top Posters In This Topic

  • Solution
Posted

Change to this code

section, section .section-border, section .section-background {
    background: transparent !important;
}

body {
    background: linear-gradient(to bottom, #4B86B9, #B2B1BF, #F16351);
    background-size: 600% 100%;
    animation: gradient 16s linear infinite;
    animation-direction: alternate;
}

@keyframes gradient {
    0% {
        background-position: 0%;
    }
    100% {
        background-position: 100%;
    }
}

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Posted
On 1/18/2024 at 12:58 AM, tuanphan said:

You mean apply the code to top section only (all pages), and keep other sections on page not gradient?

Keep the top section with no gradient and the other sections the custom gradient background. 

 

Thanks

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.