Jump to content

How can I change the content background color on only one page using CSS?

Recommended Posts

  • Replies 19
  • Views 79.7k
  • Created
  • Last Reply
  • 2 months later...

Try something else in the space after background-color: instead of #ffffff

For example, I used on my site background-color: rgba(0,0,0,0.7)

If you don't know the color code you want go to the style editor and where you choose font colors pick the color you would use for desired background and find the color's code there.

If that doesn't work do you have other css for backgrounds that may be overriding the new code you put in?

Link to comment

You may have to force a little harder by adding "!important" to that element. It's likely that the BG color is set in the template, which means you need to override it. (like...)


.collection-51fe6273e4b018cc005790bd #content { 
     background-color: #ffffff !important; 
}

Or try dropping #content


.collection-51fe6273e4b018cc005790bd { 
      background-color: #ffffff !important; 
} 



Link to comment

Hey, that doesn't work either. What I have realised, though, is that header code injection doesn't work from the back-end. If I go to the page using the viewer, use Style Mode and then implement CSS via the editor then the changes seem to be implemented.

However, I've only managed to change the background colour for the specific block of text by using:


#block-3d9d13198a3472b9fb32 { 
 background-color: #ffffff; 
 padding: 20px;
}

This still leaves the div container (?) background unchanged, though.

Link to comment
  • 5 months later...

I am also trying to get specific pages to change color on Marquee with no luck. I am using the CSS editor in the style editor, and have tried all variations:

.collection-52c9d299e4b0b674fecf2804 #content { background-color: ##60dca0 !important;

or

.collection-52c9d299e4b0b674fecf2804 { background-color: ##60dca0 !important;

and with and without !important; Perhaps marquee handles the pages differently?Or I'm doing something else wrong?

thanks!!

Link to comment
  • 1 month later...

The best solution I found is to go into the page settings in admin, lick on advanced and enter the blow in the page header code injection:


<style>

#main { background-color: #ffffff; } 

</style>

This will change the background color of only this page.

Link to comment
  • 1 month later...

This works for me on Marquee : to change the background colour of 1 page contained within the index page;


[data-url-id="YOUR PAGE URL HERE"] .content-inner { background-color: #4068b1 !important; }
[data-url-id="YOUR PAGE URL HERE"] .content { background-color: #4068b1 !important; }

The page URL is the suffix to the domain including the forward slash eg /my-page

Link to comment
  • 8 months later...
  • 1 year later...
  • 3 months later...
  • 2 weeks later...

@Anderswaltz afirm to @nonesuch's suggestion, for subpages within the index page you need to add css to index>advanced (the index page which is acting as a parent and any code in the index advanced field will flow into the subpages) . Target the subpage using its data-url-id

Example from my site, I am targeting two subpages from within the index page:


<style>
.parallax-item[data-url-id='mission'] div.title-desc-inner h1,
.parallax-item[data-url-id='mission'] div.title-desc-inner p {
  display: none !important;
}
[data-url-id="summary"] h1.page-title, 
[data-url-id="summary"] .page-desc, [data-url-id="summary"] .page-desc a  { 
  color: #333 !important;
}
</style




Link to comment

its really simple .


<style>
 .parallax-item[data-url-id='mission'] div.title-desc-inner h1,
 .parallax-item[data-url-id='mission'] div.title-desc-inner p {
   display: none !important;
 }
[data-url-id="summary"] h1.page-title, 
 [data-url-id="summary"] .page-desc, [data-url-id="summary"]{ 
  background-color: #333 !important;
}
 </style>


Link to comment
  • 1 month later...

Hi there, I would really like a solution to this problem as well, but none of the above seems to work for me. Maybe because I use a different template? I'm using Alex, does anybody have an idea?

My question is also here:https://answers.squarespace.com/questions/150634/alex-template-different-background-color-for-each.html

Link to comment
  • 2 years later...

Hi @Fox, I made a video tutorial for you on how to Change The Content Background Color. Hope this helps! https://www.askquesty.com/post/change-background-color

Have Squarespace questions/task and need help today? **You can hire us here.** Our answers are on-demand, video recorded, and only cost between $5 to $25. Estimates are free, 100% satisfaction guarantee, and trusted by hundreds of small businesses.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.