Spe92002 Posted June 6, 2008 Share Posted June 6, 2008 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; } Link to comment Share on other sites More sharing options...
dcole.ath.cx Posted June 6, 2008 Share Posted June 6, 2008 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 Link to comment Share on other sites More sharing options...
Ingolme Posted June 6, 2008 Share Posted June 6, 2008 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;} Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.