Html 如何将图像居中放置在tbody标签(也有thead)内?
HTML: 如您所见,图像在表格中没有居中(但在左侧有一点): 我如何做到这一点 代码笔:将colspan=“2”添加到Html 如何将图像居中放置在tbody标签(也有thead)内?,html,css,Html,Css,HTML: 如您所见,图像在表格中没有居中(但在左侧有一点): 我如何做到这一点 代码笔:将colspan=“2”添加到 将colspan=“2”添加到 试试这个: 试试这个: <table> <thead> <tr> <th> Column 1 </th> <th> Column 2 </th>
将colspan=“2”添加到
试试这个:
试试这个:
<table>
<thead>
<tr>
<th>
Column 1
</th>
<th>
Column 2
</th>
</tr>
<thead>
<tbody>
<tr>
<td>
<img src="https://material.io/icons/static/images/icons-180x180.png">
</td>
</tr>
</tbody>
</table>
table {
width: 100%;
margin-bottom: 1rem;
}
tbody {
background: red;
}
tbody td {
text-align: center;
}
<td colspan="2">
<img src="https://material.io/icons/static/images/icons-180x180.png">
</td>