窗口调整大小的最小宽度 [英] Min width in window resizing

查看:357
本文介绍了窗口调整大小的最小宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



当我调整浏览器窗口大小时,页面中的元素会重叠。



我会创建类似于此网站 http://bologna.bakeca.it/ 的效果当窗口小于固定宽度停止调整大小时。

解决方案

可以为body标记设置CSS的min-width属性。因为IE 6不支持这个属性,你可以这样写

  body {
min-width:1000px; / *假设你想要的最小宽度为1000px * /
width:auto!important; / * Firefox将设置宽度为auto * /
width:1000px; / *因为IE忽略!important它将宽度设置为1000px; * /
}

  body {
min-width:1000px; //假设您希望最小宽度为1000px
_width:expression(document.body.clientWidth> 1000?1000px:auto); / * sets max-width for IE * /
}


I have a webpage with a fluid layout with a 100% width.

When I resize browser window the elements in the page overlap.

I would create an effect similar to this website http://bologna.bakeca.it/ that when window is smaller than a fixed width stop resizing.

解决方案

You can set min-width property of CSS for body tag. Since this property is not supported by IE 6 you can write like

body{
   min-width:1000px; /* suppose you want minimun width of 1000px */
   width: auto !important;  /* Firefox will set width as auto */
   width:1000px;             /* As IE ignores !important it will set width as 1000px; */
}

Or

body{
   min-width:1000px; // suppose you want minimun width of 1000px
   _width: expression( document.body.clientWidth > 1000 ? "1000px" : "auto" ); /* sets max-width for IE */
}

这篇关于窗口调整大小的最小宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆