Hello.So i have a website.Here is the whole code <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>My site</title> <link href="styles.css" type="text/css" rel="stylesheet" media="screen"> </head> <body> <div id="wrapper"> <img src="images/0_3e126_5f08e893_L.jpg" /> <ul> <li><a href="index.html">One</a></li> <li><a href="stihi.html">Two</a></li> </ul> <h1>Headings</h1> <p>Paagraphs</p> <div id="footer"> <p>2013</p> </div> </div> </body> </html> So,wrapper contains all content and it is centered on the page .But there is a problem.Outside of wrapper from the top and the bottom there is a margin.I don't want it.Who knows,how can i remove it?I know i can do negative margin,but is it really a good way? Also,here is css #wrapper { margin:0px auto; width:500px; background-color:#F4F4F4; } ul { background-color:#0F9; } li { display:inline; margin-right:30px; } ul li a { font-size:20px; text-decoration:none; } a:link { color:#55002B; } a:hover { color:#639; } h1 { color:#0f9; text-align:center; font-size:40px; } p { color:#BB005E; font-size:17px; } #footer { border-top:solid #000 2px; } #footer p { text-align:center; }
It's caused by the browser's default styles. You need to override those styles. Set body { margin: 0px; } That should do it. All care!
laylajune answers you very nicely but there is an other solution *{margin:0; padding:0;} use this code in your css by using this code you will never get any extra margin or padding
It is very easy to remove extra margin in your body by following this CSS code for body. body {margin:0px;} or *{margin:0px;}
Use a basic reset. Also, next time you have a CSS-related question you should probably put your sample code into something like jsfiddle so that it's easier for people to help you. The more you do to make answering your questions easy the more likely you are to get quality responses quickly.