0

I have div tag inside body

html:

<!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> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="header"> </div> </body> </html> 

css:

body{ background:#787777; font-family:"Droid Sans",Helvetica,Arial,Sans-Serif; font-size:0.81em; } #header{ height:100px; background:#000000; width:100%; margin:0px; } 

and here is result as you see there is spaces left, top and right. How i can remove this spaces? enter image description here

2 Answers 2

3
body{ background:#787777; font-family:"Droid Sans",Helvetica,Arial,Sans-Serif; font-size:0.81em; margin: 0; padding: 0; } 
Sign up to request clarification or add additional context in comments.

2 Comments

Just adding margin:0 to the body selector should do it
Could you please answer stackoverflow.com/questions/9943560/… ?
2

You need to remove the margin and padding around the <body> element. Browsers will add one or the other by default, so you need to explicitly set them to 0:

body { background:#787777; font-family:"Droid Sans",Helvetica,Arial,Sans-Serif; font-size:0.81em; margin: 0px; padding: 0px; } 

Different browsers have different default styles, so setting both padding and margin to 0 ensures you don't get a gap.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.