Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 最大值/最小值(宽度和高度)不正常?_Html_Css - Fatal编程技术网

Html 最大值/最小值(宽度和高度)不正常?

Html 最大值/最小值(宽度和高度)不正常?,html,css,Html,Css,我在教程中尝试了以下代码: <html> <head> <style type="text/css"> p{ border: 2px solid #6374AB; padding: 10px; } p.test1{max-width:50px;} p.test2{min-width:800px;} p.tes

我在教程中尝试了以下代码:

   <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> 

p{
边框:2px实心#6374AB;
填充:10px;
}
p、 test1{最大宽度:50px;}
p、 test2{最小宽度:800px;}
p、 test3{最大高度:20px;}
p、 test4{最小高度:200px;}
p、 测试5{
最大高度:50px;
最大:宽度:50px;
}
这是默认的测试段落。以下所有段落都添加了额外的最小/最大声明

最大宽度为50px的测试段落

最小宽度为800px的测试段落

用最大高度测试段落:20px,尽管我在其中放了很多内容,只是想稍微拉伸一下(当然,由于标准的强大,这不起作用)

最小高度为200px的测试段落

最大高度的测试段落:50px;最大宽度:50px


但问题是,中显示的结果不是我得到的结果,max/min(宽度和高度)不应该起作用。谁能给我解释一下吗?我当前的浏览器是IE8。谢谢……

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


这是因为IE8在无法判断页面是否处于怪癖模式时自行决定如何呈现页面。

您使用的是
max:width
,而不是
max width