Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/81.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表rowspan时出现意外行为_Html_Html Table - Fatal编程技术网

使用HTML表rowspan时出现意外行为

使用HTML表rowspan时出现意外行为,html,html-table,Html,Html Table,我正在创建一个动态表生成器,在测试期间,我发现以下生成的HTML在所有浏览器(Firefox、Chrome、IE)中都提供了意外的布局 结果: |------|-------| | | | | | | |------|-------| | | | | | | |------|-------| 编辑2: 添加CSS table { border: 2px solid #000000; paddi

我正在创建一个动态表生成器,在测试期间,我发现以下生成的HTML在所有浏览器(Firefox、Chrome、IE)中都提供了意外的布局

结果:

|------|-------|
|      |       |
|      |       |
|------|-------|
|      |       |
|      |       |
|------|-------|
编辑2: 添加CSS

table { 
   border: 2px solid #000000;
   padding: 10px;
}
td { 
   border: 2px solid #FF0000;
   height: 100px;
   width: 100px;
   padding: 10px;
}
tr {
   border: 2px solid #00FF00;
   padding: 10px
}
我还尝试:

<table>
    <tr>
        <td rowspan="2" style="border: 1px solid #FF0000; height:200px"></td>
        <td style="border: 1px solid #FF0000; height:100px"></td>
    </tr>
    <tr>
        <td rowspan="2" style="border: 1px solid #FF0000; height:200px"></td>
    </tr>
    <tr>
        <td style="border: 1px solid #FF0000; height:100px"></td>
    </tr>
</table>


我看到了您描述的布局:。你也能展示一下CSS吗?当然。。在问题中尝试此css我得到了所需的布局,当您填充表格时应该可以。抱歉。。填写。。但是你已经得到了。。看起来关键是tr.height。。。有了它,一切都会好起来。。(这真的很有帮助。。。如果你愿意,一定要填写答案,这样我才能投你一票。。(人们都知道我有多傻:)
table { 
   border: 2px solid #000000;
   padding: 10px;
}
td { 
   border: 2px solid #FF0000;
   height: 100px;
   width: 100px;
   padding: 10px;
}
tr {
   border: 2px solid #00FF00;
   padding: 10px
}
<table>
    <tr>
        <td rowspan="2" style="border: 1px solid #FF0000; height:200px"></td>
        <td style="border: 1px solid #FF0000; height:100px"></td>
    </tr>
    <tr>
        <td rowspan="2" style="border: 1px solid #FF0000; height:200px"></td>
    </tr>
    <tr>
        <td style="border: 1px solid #FF0000; height:100px"></td>
    </tr>
</table>