十一、 最小宽度
IE6另外一个bug就是它不支持 min-width 属性. min-width又是相当有用的, 特别是对于弹性模板来说, 它们有一个100%的宽度,min-width 可以告诉浏览器何时就不要再压缩宽度了。
除IE6以外所有的浏览器你只需要一个 min-width: Xpx; 例如:
.container { min-width:300px; } |
为了让他在IE6下工作, 我们需要一些额外的工作. 开始的时候我们需要创建两个div, 一个包含另一个:
<div class="container"> <div class="holder">Content</div> </div> |
然后你需要定义外层div的min-width属性
.container { min-width:300px; } |
这时该是IE hack大显身手的时候了. 你需要包含如下的代码:
* html .container { border-right: 300px solid #FFF; } * html .holder { display: inline-block; position: relative; margin-right: -300px; } |
As the browser window is resized the outer div width reduces to suit until it shrinks to the border width, at which point it will not shrink any further. The holder div follows suit and also stops shrinking. The outer div border width becomes the minimum width of the inner div.
十二、隐藏水平滚动条
为了避免出现水平滚动条, 在body里加入 overflow-x:hidden 。
当你决定使用一个比浏览器窗口大的图片或者flash时, 这个技巧将非常有用。
本文转载自52CSS,原文地址:http://www.52css.com/article.asp?id=809

RSS订阅