【发布时间】:2010-10-25 22:02:20
【问题描述】:
我在根据需要在 div 中放置 div 时遇到问题。请看下面的代码。
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div style="min-width:100%; min-height:90%; background-color:Red; text-align:center;">
<div style="min-height:100%; background-color:Green; width:90%; height:100%;
color:White;">testing 100% height and 90% width in red container</div>
</div>
<div style="min-height:10%; background-color:Yellow; width:100%;"></div>
</body>
</html>
现在我想通过利用红色 div 的所有高度将绿色 div 放置在红色 div 内。因此,绿色 div 的高度应与红色 div 相同,宽度应为红色 div 宽度的 90%。我想我也做了同样的事情,但它在任何浏览器中都不起作用。
要查看问题,请复制我提供的代码并将其保存为 HTML 文件。然后在 IE 中查看。
请帮帮我。
【问题讨论】:
-
它似乎在 FF 中按照您描述的方式工作。