Jump to content

Adding a fixed background to a page

Recommended Posts

I've tried to add a fixed background to a page on my site but it doesnt seem to work ....Any one that has an idea of why?

Site password: "642Rasmus"

 

here´s the code I´ve applied:

 

<style>
  body::before {
  background-image: url(https://static1.squarespace.com/static/6350e9718a76f94ed97ba1a0/t/640318bcb19d2c72651a46bf/1677924541482/UNA-OysterCava-05362.jpg);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  content: '';
  height: 100%;
  opacity: 1;
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  z-index: -10;
}

.page-section,
.page-section .section-background {
  background-color: transparent !important;
}
</style>

Edited by rasmusarentsen
spelling errors
Link to comment
  • rasmusarentsen changed the title to Adding a fixed background to a page
  • Replies 1
  • Views 276
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Hi,

Try this new code. If it doesn't work, please share link to your site

<style>
  body{
  background-image: url(https://static1.squarespace.com/static/6350e9718a76f94ed97ba1a0/t/640318bcb19d2c72651a46bf/1677924541482/UNA-OysterCava-05362.jpg);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  height: 100%;
  opacity: 1;
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  z-index: -10;
}

.page-section, .page-section .section-background, .section-border, .section-divider {
  background-color: transparent !important;
}
</style>

 

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

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.