tags:

views:

33

answers:

4

I want my background to cover the total width of the browser like in facebook website

http://www.flickr.com/photos/41695354@N08/4228675694/

but my background gives gaps on both side of the browser (left and right)

http://www.flickr.com/photos/41695354@N08/4227911233/

why this happens??

Help me

my css

body
{
color:#000000;
background-color:#FFFFFF;
}

.wrapper
{
 margin:0px auto;
 border:#000000 1px solid;
 height:38px;
 background-image:url(../images/logo_bck.jpg);
}

html

<body>
    <div class="wrapper">
        </div>
</body>
+1  A: 
* {
  margin: 0;
  padding: 0;
}
hsz
This will cause you more problems down the road! You'll have to completely re-style your paragraphs, form elements, etc.
Jonathan Sampson
why this cause problem sampson?
Rajasekar
If you work with it from the beggining - it will not. It is good way to have every tag in controll I think.
hsz
oh so i should include this in body. right??
Rajasekar
On the top of CSS file.
hsz
It isn't a problem as long as you know you have to do it. However it really is sort of a scorched earth policy to css and page development.
wlashell
+1  A: 

Reset the margin/padding of HTML/BODY to eliminate this issue.

html, body { margin:0; padding:0; }

As a more thorough solution to these types of problems, I would suggest using a Reset style-sheet in every project.

Jonathan Sampson
+2  A: 

I assume you're not using a reset style sheet... the body tag usually defaults to having a margin. you should be able to fix your problem by adding the rule:

html, body { 
  margin: 0;
  padding: 0;
}
jennyfofenny
+1  A: 

In addition to the other answers regarding default padding & margin given by the various browsers, the easy way to start to determine which element has what layout and attributes is to use Firebug.

http://getfirebug.com/

It has made web development so much easier to do for me, and many others.

wlashell