pAk*_*Y88 30 html css window-resize
我有一个流畅布局的网页,宽度为100%.
当我调整浏览器窗口大小时,页面中的元素重叠.
我会创建一个类似于这个网站http://bologna.bakeca.it/的效果,当窗口小于固定宽度时停止调整大小.
Chi*_*e G 50
您可以为body标签设置CSS的min-width属性.由于IE6不支持此属性,您可以这样写:
body{
min-width:1000px; /* Suppose you want minimum width of 1000px */
width: auto !important; /* Firefox will set width as auto */
width:1000px; /* As IE6 ignores !important it will set width as 1000px; */
}
Run Code Online (Sandbox Code Playgroud)
要么:
body{
min-width:1000px; // Suppose you want minimum width of 1000px
_width: expression( document.body.clientWidth > 1000 ? "1000px" : "auto" ); /* sets max-width for IE6 */
}
Run Code Online (Sandbox Code Playgroud)
好吧,你几乎给了自己答案.在CSS中,为包含元素指定最小宽度.如果你必须支持IE6,你可以使用min-width-trick:
#container {
min-width:800px;
width: auto !important;
width:800px;
}
Run Code Online (Sandbox Code Playgroud)
这将有效地为您提供IE6中的800px最小宽度和任何最新的浏览器.