Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/69.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/32.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 如何在td中垂直拉伸div?_Html_Css_Layout - Fatal编程技术网

Html 如何在td中垂直拉伸div?

Html 如何在td中垂直拉伸div?,html,css,layout,Html,Css,Layout,我在一辆td车里有一个div。td有一个高度。如何垂直拉伸div-无需明确设置其高度 <td style='height:200px'> <div>hello<div> <td> 你好 我尝试设置垂直对齐,但没有“拉伸”值。这个怎么样 <td style='height:200px'> <div style="height:100%">hello<div> <td> 你好 好的,这是一个明

我在一辆td车里有一个div。td有一个高度。如何垂直拉伸div-无需明确设置其高度

<td style='height:200px'>
<div>hello<div>
<td>

你好
我尝试设置垂直对齐,但没有“拉伸”值。

这个怎么样

<td style='height:200px'>
<div style="height:100%">hello<div>
<td>

你好
好的,这是一个明确的定义,但它根据父元素进行拉伸。

这个如何

<td style='height:200px'>
<div style="height:100%">hello<div>
<td>

你好

好的,这是一个明确的定义,但它会根据父元素进行拉伸。

Sample

HTML

<table>
    <tr>
        <td style='height:200px; border: 1px solid red;'>
            <div style="border: 1px solid blue;">hello</div>
        </td>
    </tr>
</table>
div { /* This is a sample! Of course a class 'my_div' would make more sense */
    height: 100%;
}

样本

HTML

<table>
    <tr>
        <td style='height:200px; border: 1px solid red;'>
            <div style="border: 1px solid blue;">hello</div>
        </td>
    </tr>
</table>
div { /* This is a sample! Of course a class 'my_div' would make more sense */
    height: 100%;
}
试试这个:

td div {
   height:100%
} 
试试这个:

td div {
   height:100%
} 
试试这个:

如果文本需要更多的空间(垂直),它将自动拉伸。

试试这个:


如果文本需要更多的空间(垂直),它将自动拉伸。

您没有任何结束标记。您是否尝试过身高:100%用于div?您没有任何结束标记。您是否尝试过身高:100%用于div?