Jump to content

New to CSS - how to put background color into style sheet?


mrhello

Recommended Posts

Hi all!

 

I am a newbie with CSS and actually not very asvvy.

I got this new full css template and would like to be able to change the background color on which the website "sits".

 

Originally the background color was within the html coding of every page like this: (I have deleted this, because I thought it is otherwise over writing the stylesheet command for the color?)

 

 

Now I would like to put the background color into the style sheet, so I can change the color site-wide, if required. The code in the style sheet is:

#container {

width: 950px;

margin-right: auto;

margin-left: auto;

background-color: white;

border: thin;

border-color: #a9a9a9;

border-style: solid;

}

#body{

margin: 0px;

padding: 0px;

font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;

font-size: 13px;

color: black;

}

 

What needs to be altered in the style sheet and what would I need to put onto the page source code??

 

Thanks in advance for your help and advice,

 

new-to-css

Link to comment
Share on other sites

i think all you have to do is add background-color to #body.

 

#body{

margin: 0px;

padding: 0px;

font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;

font-size: 13px;

color: black;

background-color: silver

}

 

 

and to link a web page to the style sheet, you need to add:

 

 

where style.css is the name of your css file. this line needs to go the head tags. for example:

 

Your Page

 

 

hope this helps. you should check out w3school's site. it is full of helpful tutorials.

Link to comment
Share on other sites

1st) Remove (background-color: rgb(255, 255, 0); direction: ltr;) from your

tag in the html.

 

2nd) Add it to your style sheet......... body {background-color: rgb(255, 255, 0);} you should not need the direction: ltr;

 

As jlhaslip mentioned, remove the hash mark from in front of body. Do you have an id set for container, if not remove the hash mark there also.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...