How do I change the background color of a single page using CSS?

I'm trying to edit a single page's background color, rather than the entire site. To do this, I've been told you have to enter CSS code with a page specific ID, which is what I've done:

body collectionId-506c8e08e4b04376cb19938d {
   background: #black;
}
h1 {
   background-color: #00000;
}

All I want is for the page to be black instead of white. You'll notice the code includes the single page ID, but for some reason, it's not changing the color of background. Perhaps I've entered the wrong code? IDK. Any help is greatly appreciated.

asked Oct 24 '12 at 13:47 by COUP 1112


Use:

{ background: black; }

or

{ background: #000000; }

These all mean the same thing. The # symbol is a reference to hex notation for colours, so putting #black is gibberish to a computer. There are also others ways to choose colours such as rgb, rgba and hsla (the last 2 include alpha/transparency), but hex is the standard (and what i'd advise unless you need alpha).

Also, make sure the CSS selector is correct, you need to a # in front of collectionId, remove the space just after body and remove the "Id" from collectionId:

body#collection-506c8e08e4b04376cb19938d {...}

answered Oct 24 '12 at 15:43 by Alex 2.9k3813

link

I've updated my answer.

(Oct 24 '12 at 16:06) Alex Alex's gravatar image
1

Ah right, no, you shouldn't be getting this from the url. You need to use your browser tools to inspect the dom. There's no "Id" in the collectionId selector. I've updated the answer.

(Oct 24 '12 at 16:35) Alex Alex's gravatar image

That worked! Thank you a ton Alex. Now to figure out how to edit the tab/navigator section. I think I can figure this one out.

(Oct 24 '12 at 16:52) COUP COUP's gravatar image

Is it possible to change the canvas size using this method, on one specific page? I've tried this, but its not working for me. Thanks!

body#collection-5262ef42e4b070ba82437d3b {
  #canvas {
    max-width: 640px;
    margin: -20px auto;
    padding: 60px;
  }
}
(Oct 19 '13 at 17:35) andrew22 andrew22's gravatar image

body {background-color:#C0C0C0;}

More detailed about .... CSS background Color

jery

answered Jan 21 at 02:59 by jeryymanly 1

link
Your Answer
toggle preview

Follow This Question

Once you sign in you will be able to subscribe for any updates here

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×453
×34
×6
×2

Asked: Oct 24 '12 at 13:47

Seen: 10,105 times

Last updated: Jan 21 at 02:59

Established 2004 Handmade in NYC