我在教程http://www.quirksmode.org/css/width.html中尝试了以下代码:
<html>
<head>
<style type="text/css">
p{
border: 2px solid #6374AB;
padding: 10px;
}
p.test1{max-width:50px;}
p.test2{min-width:800px;}
p.test3{max-height:20px;}
p.test4{min-height:200px;}
p.test5{
max-height:50px;
max:width:50px;
}
</style>
</head>
<body>
<p>This is the default test paragraph. All paragraphs below have an extra min/max declaration added.</p>
<p class="test1">Test paragraph with max-width: 50px</p>
<p class="test2">Test paragraph with min-width: 800px</p>
<p class="test3">Test paragraph with max-height: 20px, even though I put a lot of content in just to try to stretch it a tiny little bit (which, of course, doesn't work thanks to the Power of Standards).</p>
<p class="test4">Test paragraph with min-height: 200px</p>
<p class="test5">Test paragraph with max-height: 50px; max-width: 50px</p>
</body>
</html>
但问题是http://www.quirksmode.org/css/width.html中显示的结果不是我得到的结果,而max / min(宽度和高度)不应该起作用。有人可以向我解释一下吗?我目前的浏览器是IE8.Thanks ....
答案 0 :(得分:0)
您需要在IE8中打开兼容模式才能正确查看页面。 (单击地址栏旁边带有“teared page”图标的按钮。)
这是因为当IE8无法判断它们是否处于怪癖模式时,它会自行决定如何呈现页面。