Jump to content

CSS Gradient Background

Recommended Posts

Posted (edited)

Hi,

I'm currently working on building a site. I wanted to use this code to have an animated gradient background.

body {
  margin:0;
}
.wrapper {
    width: 100%;
    height: 100%;
    position: absolute;
    background: linear-gradient(60deg,#fffdf8, #ffcae0);
    background-size: 600% 100%;
    animation: gradient 5s linear infinite;
    animation-direction: alternate;
}
@keyframes gradient {
    0% {background-position: 0%}
    100% {background-position: 100%}
}

 

I've pasted in to 'Custom CSS' section but can't see it working. Do I need to add some more code for it to work?

 

This is the link to the css I want to use.

https://codepen.io/redstapler/pen/LMyLxP

 

Thanks in advance.

Edited by ToldTales
Missed a link out
Posted
3 hours ago, ToldTales said:

Hi,

I'm currently working on building a site. I wanted to use this code to have an animated gradient background.

body {
  margin:0;
}
.wrapper {
    width: 100%;
    height: 100%;
    position: absolute;
    background: linear-gradient(60deg,#fffdf8, #ffcae0);
    background-size: 600% 100%;
    animation: gradient 5s linear infinite;
    animation-direction: alternate;
}
@keyframes gradient {
    0% {background-position: 0%}
    100% {background-position: 100%}
}

 

I've pasted in to 'Custom CSS' section but can't see it working. Do I need to add some more code for it to work?

 

This is the link to the css I want to use.

https://codepen.io/redstapler/pen/LMyLxP

 

Thanks in advance.

Do you want to set this effect on an unique section or entire your page?

Kindly share your site with the protected password to check it together

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </>  🗓️ Delivery Date Picker (Date picker form field)
Gallery block 7.1 workaround </> 🤖 Ask me anything

Posted
On 12/3/2021 at 2:09 AM, ToldTales said:

It would be great to have it as the entire page.

https://vuvuzela-mackerel-m37a.squarespace.com

password: cssbackground

Thanks for your help

Is it the result you want to achieve?

 Try adding to Home > Design > Custom Css
section, section .content-wrapper, section .section-background {
  background: transparent !important;
}
#siteWrapper {
  background: linear-gradient(45deg,#F17C58, #E94584, #24AADB , #27DBB1,#FFDC18, #FF3706);
  background-size: 600% 100%;
  animation: gradient 16s linear infinite;
  animation-direction: alternate;
}


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

Let me know how it works on your site

Support me by pressing 👍 if this useful for you

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </>  🗓️ Delivery Date Picker (Date picker form field)
Gallery block 7.1 workaround </> 🤖 Ask me anything

  • 1 month later...
Posted (edited)
On 12/4/2021 at 3:38 AM, bangank36 said:

Is it the result you want to achieve?

 

 Try adding to Home > Design > Custom Css
section, section .content-wrapper, section .section-background {
  background: transparent !important;
}
#siteWrapper {
  background: linear-gradient(45deg,#F17C58, #E94584, #24AADB , #27DBB1,#FFDC18, #FF3706);
  background-size: 600% 100%;
  animation: gradient 16s linear infinite;
  animation-direction: alternate;
}


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

Let me know how it works on your site

Support me by pressing 👍 if this useful for you

hey @bangank36 how can I do this to target just one section of a page? I am trying to wrap the CSS you provided within a data section ID, and then it stops working.

Thanks in advance!

Edited by happyscone
Posted
On 1/22/2022 at 5:49 AM, happyscone said:

how can I do this to target just one section of a page? I am trying to wrap the CSS you provided within a data section ID, and then it stops working.

Thanks in advance!

try this CSS

[data-section-id="id here id here"] {
&, .content-wrapper, .section-background {
  background-color: transparent !important;
}
.section-background {
background: linear-gradient(45deg,#F17C58, #E94584, #24AADB , #27DBB1,#FFDC18, #FF3706);
  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
33 minutes ago, tuanphan said:

try this CSS

[data-section-id="id here id here"] {
&, .content-wrapper, .section-background {
  background-color: transparent !important;
}
.section-background {
background: linear-gradient(45deg,#F17C58, #E94584, #24AADB , #27DBB1,#FFDC18, #FF3706);
  background-size: 600% 100%;
  animation: gradient 16s linear infinite;
  animation-direction: alternate;
}
}
@keyframes  gradient {
  0% {background-position: 0%;}
  100% {background-position: 100%;}
}

 

Thanks @tuanphan this worked! 

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.