美文网首页
IE6不支持CSS中的min-width/height属性问题的

IE6不支持CSS中的min-width/height属性问题的

作者: 开车去环游世界 | 来源:发表于2016-11-22 15:32 被阅读20次

废话少说!

最小高度:

.your-class {
    min-height: 1000px;
    height: auto !important;
    height: 1000px;
}

最小宽度:

.your-class {
    min-width: 1000px;
    width: auto !important;
    width: 1000px;
} 

重点:
先利用较新的浏览器识别min-width/height,透过它来指定值,而IE6则是透过width/height取值。 不过这里有个冲突,就是新的浏览器也识别width/height,因此min-width/height会被width/height改写,解決的办法,就是中间那一行。 height: auto !important;(以及width: auto !important;) 由于它标示!important,所以下面那行height无法取代上面这一行,见解变成新的浏览器忽视掉第三行,而让高度不受第三行影响。 另外由于IE6不识别 min-height和 !important属性,所以它还是取第三行的语法,这样就可以相安无事,皆大欢喜。

相关文章

网友评论

      本文标题:IE6不支持CSS中的min-width/height属性问题的

      本文链接:https://www.haomeiwen.com/subject/isoppttx.html