2011-07-12 37 views
0

我已经尝试了代码中的教程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已经示出的结果是没有什么IAM获取和最大/最小(宽度和高度)不应该是工作。任何人都可以向我解释这个吗?我当前的浏览器是IE8.Thanks ....

+1

你有'max:width'而不是'max-width'。 – alex

回答

0

您需要打开IE8中的兼容模式才能正确查看您的页面。 (点击地址栏旁边带有“泪流满面”图标的按钮。)

这是因为当它无法确定它们是否处于怪癖模式时,IE8会自行决定如何渲染页面。

相关问题