CSS 100% width on browser resize

喜欢而已 提交于 2019-11-29 14:02:10

I'm not completely clear on your issue, but you can set min-width:996px; on the header and footer to keep them at least as wide as the content.

Try this, and please use HTML5's doctype.

<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
        <style type="text/css">
            body{margin:0;text-align:center;}
            .header,.content,.footer{text-align:left;clear:both;margin:0 auto;}
            .header,.footer{width:100%;background-color:blue;height:128px;min-width:996px;}
            .content{width:996px;height:512px;background-color:red;}
        </style>
        <title>Index</title>
    </head>
    <body>
        <div class="header">
            Header stuff here
        </div>
        <div class="content">
            Page content stuff here
        </div>
        <div class="footer">
            and your footer...
        </div>
    </body>
</html>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!