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
使用css为td中的div着色_Css - Fatal编程技术网

使用css为td中的div着色

使用css为td中的div着色,css,Css,我只需要在td元素中为div着色。 如果使用position:absolute,则彩色div将填充整个屏幕,如果使用relative,则不会发生任何情况 我的代码: <table width="100%" border="1"> <tr height= "200px"> <td> <div style="width: 100%; height: 100%; z-index: 0; background-co

我只需要在td元素中为div着色。 如果使用position:absolute,则彩色div将填充整个屏幕,如果使用relative,则不会发生任何情况

我的代码:

<table width="100%" border="1">
    <tr height= "200px">
        <td>
            <div style="width: 100%; height: 100%; z-index: 0; background-color: green; position:relative; top: 0; left: 0;"></div>
        </td>
        <td>
            <div style="width: 100%; height: 100%; z-index: 0; background-color: red; position:relative; top: 0; left: 0;"></div>
        </td>
    </tr>    
</table>

衷心感谢您的帮助

谢谢

需要是相对的,
需要是绝对的,那么td将被视为一个容器,它包含了什么


必须是相对的,
必须是绝对的,然后td将被视为一个容器,它包含了什么


必须是相对的,
必须是绝对的,然后td将被视为一个容器,它包含了什么


必须是相对的,
必须是绝对的,然后td将被视为一个容器,它包含了什么



您到底想要什么?为什么要使用相对/绝对。。。有什么原因吗?@KarthikN:我只是想在td elementok有一个完全覆盖的div。那就用机器人86PL回答你到底想要什么?为什么要使用相对/绝对。。。有什么原因吗?@KarthikN:我只是想在td elementok有一个完全覆盖的div。那就用机器人86PL回答你到底想要什么?为什么要使用相对/绝对。。。有什么原因吗?@KarthikN:我只是想在td elementok有一个完全覆盖的div。那就用机器人86PL回答你到底想要什么?为什么要使用相对/绝对。。。有什么原因吗?@KarthikN:我只是想在td elementok有一个完全覆盖的div。然后用机器人86PL回答