Jump to content
Sign in to follow this  
Spe92002

CSS Background Color

Recommended Posts

Hey, I am new to css and I am having a little trouble apply background color to my page. Thats my css code right now for my page and it says every background color will be gray. However, I am using internet explorer, firefox, and safari, and it is not showing the background in gray, it shows it in white. Thanks in advance! Here is my code:body { font-family: verdana, arial, serif; background: #CCCCCC; font-size: 10pt; margin-top: 0; margin-bottom: 0; margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0;}}#header { background: #CCCCCC; margin: 20px; padding: 10px; height: 100px;}#left { background: #CCCCCC; position: absolute; left: 15px; top: 160px; width: 200px;}#center { background: #CCCCCC; top: 0; margin-left: 230px; margin-right: 15px;}h1 {font-family: verdana, arial, serif; font-size: 18pt;font-weight: lighter; }

Share this post


Link to post
Share on other sites

If your only going to set the background color, then the best bet would be to use "background-color" tag instead of "background".When I use the "background" tag I always define everything, such as "background: #CCC none repeat scroll 0%;"You can get more information at http://www.w3schools.com/css/css_background.asp

Share this post


Link to post
Share on other sites

Let me fix this up for you. The most probable reason that it wasn't working was that you had two closing braces after the body CSS.Aside from that, in certaindoctypes applying CSS only to the body won't work, you have to add it to the html element too. You don't need to assign the same background color to all the elements.

html,body {font-family: verdana, arial, serif;background-color: #CCCCCC;font-size: 10pt;margin: 0;padding: 0;}#header {margin: 20px;padding: 10px;height: 100px;}#left {position: absolute;left: 15px;top: 160px;width: 200px;}#center {margin-left: 230px;margin-right: 15px;}h1 {font-family: verdana, arial, serif;font-size: 18pt;font-weight: lighter;}

Share this post


Link to post
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.

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...
Sign in to follow this  

×
×
  • Create New...