Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/79.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 容器内50%的Div_Html - Fatal编程技术网

Html 容器内50%的Div

Html 容器内50%的Div,html,Html,我们是否可以为位于容器(首选表格单元格)内的div设置高度:50% 我们不知道的维度,它们可能会动态变化很多。您可以为div设置高度,但是父元素也必须显式设置其高度。例如: <html> <head> </head> <body style="height:100%"> <table style="height:100%"> <tr> <td style="height:100%

我们是否可以为位于容器(首选表格单元格)内的div设置
高度:50%


我们不知道的维度,它们可能会动态变化很多。

您可以为div设置高度,但是父元素也必须显式设置其高度。例如:

<html>
<head>
</head>
  <body style="height:100%">
    <table style="height:100%">
      <tr>
        <td style="height:100%">
          <div style="height:50%">
          </div>
        </td>
      </tr>
    </table>
  </body>
</html>


所以,容器高度动态变化并不重要,只要设置了它。还有其他方法,这可能是最简单的。

表格布局。。。你应该被枪杀:D