【发布时间】:2022-01-02 21:14:09
【问题描述】:
我开始学习 HTML。在我创建的表中,我使用rowspan,但是当我在展开的列中插入图像时,图像似乎没有在整个单元格中展开。所以表格的行开始有不同的高度。
这发生在 EDGE 和 IE 中,但不会在 OPERA、Firefox 等中发生,如下图所示。那里的列高也不一致。
理想情况下,我希望由其内容标识的单元格具有以下高度(假设行高固定):
标题 1 和 2:1 列
标题 3 和 4:2 列
左图高度:4 列
右图高度:6列
body{
background-color:#FFFF99
}
img {
height: 70px;
display:block;
}
h1{
font-style: italic;
color:#3300CC;
}
table, th, td {
border: 1px solid black;
border-spacing:3px;
}
table {
width: 75%;
}
th {
padding:4px;
text-align:right;
}
td{
padding:4px;
}
.Tablestyle1{
background-color: #00CC66;
text-align: center
}
<h1>TITLE </h1>
<table>
<tr class="Tablestyle1" > <!--First Row-->
<td>A</td>
<td colspan="4">B</td>
</tr>
<tr>
<td class="Tablestyle1"rowspan="2">C</td>
<th>Header1</th>
<td> D</td>
<td rowspan="6"> <img src="https://www.w3schools.com/images/w3schools_green.jpg" alt="alt1" >
<td rowspan="6">
<ol type="I">
<li>List1</li>
<li>List2</li>
<li>List3</li>
</ol>
</tr>
<tr>
<th>Header2</th>
<td>F</td>
</tr>
<tr>
<td rowspan="4">
<img src="https://www.w3schools.com/images/w3schools_green.jpg" alt="alt2" >
</td>
<th rowspan="2">Header3</th>
<td rowspan="2">H</td>
</tr>
<tr></tr>
<tr>
<th rowspan="2">Header4</th>
<td rowspan="2">L</td>
</tr>
<tr></tr>
<tr>
<td colspan="5">
<a href="*"> Link1</a>
</td>
</tr>
</table>
【问题讨论】:
标签: html css html-table