mike12255 Posted August 6, 2009 Share Posted August 6, 2009 So im trying to make the header background color go across the entire width of the page but there is about 1-2px on both ends of the rectengale of white space, does anyone know why? Here is my code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> <!-- #header{ width:100%; height:100px; padding:0; background-color:#9E0511; } body { margin-top:0; background-color: #FFFFFF; } --> </style></head> <body> <div id="header" > Testing </div> </body> </html> Quote Link to comment Share on other sites More sharing options...
haku Posted August 6, 2009 Share Posted August 6, 2009 First off: <style type="text/css"> <!-- #header{ width:100%; height:100px; padding:0; background-color:#9E0511; } body { margin-top:0; background-color: #FFFFFF; } --> </style> You don't need <!-- and --> Those were originally for javascript, not CSS, and you don't even need them for javascript anymore. So you can take them out. But that won't fix your problem. You should be able to fix your problem by setting the padding to 0 (zero) on the body. Quote Link to comment Share on other sites More sharing options...
Maknis Posted August 6, 2009 Share Posted August 6, 2009 body { margin:0; background-color: #FFFFFF; } that will do it also in case you didn't know.. margin: 0; will give 0px to top left right and bottom margin: 0 0; is the same but the first 0 represents both top and bottomt and the 2nd 0 is left and right or you could go right out with margin: 0 0 0 0; think of it as a clock the order is Top right bottom left. ** i may have the orders mixed up been a while since i played with them Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.