Jump to content

Gradient Background using CSS

Go to solution Solved by tuanphan,

Recommended Posts

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 

Link to comment
  • Replies 6
  • Views 1.3k
  • Created
  • Last Reply

Top Posters In This Topic

  • Solution

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!)

Link to comment
On 1/17/2024 at 12:08 AM, Tom1464 said:

One More thing, is there a way to make this apply for every section bar the top one?

 

Thanks

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

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!)

Link to comment
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

Link to comment

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.