开发者

how to remove the space in the top e in the bottom of a page?

I have this classic container:

.container { width: 910px;
             margin-left: auto;
             margin-right: auto;
             position: relative; 
             background-image:url(../images/background.png);
             background-repeat:repeat-y; }

but it creates a small space (like 5, 10 px) in开发者_高级运维 the top and in the bottom of the page.

Why? And how can I fix it?


You need to zero the page's margin and padding, like this:

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

Some people like to use a CSS Reset to handle problems like this.

Personally, I don't for reasons summed up here: http://snook.ca/archives/html_and_css/no_css_reset/.


Add this:

.container
{
    margin: 0 auto 0 auto;
}

You may also need to adjust the margin and padding of the "thing" that .container is within.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜