CSS background and body height 100%

2019-05-21 09:57发布

I am having trouble getting my background image to span the entirety of my content.

I looked at other questions and it seems that I need to set a min-width of 100% on each container... but I tried every combination and it still wasn't working.

Here is my HTML:

<body>
<div id="container">

    <div id="header">
                 header content...             
    </div>
    <div id="content">

        <div id="myAccountArea" class="section">
            accountArea content...
        </div>

        <div id="myPostsArea" class="section">
        postsArea content...
        </div>

    </div>
    <div id="footer">
    </div>
</div>

CSS:

html, body {
    margin: 0;
    padding: 0;
    height:100%
}

body {
    background: red;
}

#container {
    padding-top: 80px;
    margin-left: auto;
    margin-right: auto;
    width: 1000px;
    min-width: 1000px;
}

#content {
    min-width:1000px;
}

The problem I am having is that the postsArea content usually spans more than the browser's window, but the background does not.

Thanks


EDIT

Ok, so I narrowed it down to a reset.css file... Any tips on going about discovering the problem in that file?

Thanks.

1条回答
唯我独甜
2楼-- · 2019-05-21 10:13

Ok, so after looking at the reset stylesheet, I discovered this:

html {
     background:#FFF
}

Commented this line out and everything seems to be fine :)

Thanks a lot for all the help

查看更多
登录 后发表回答