Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.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 如何将图像居中放置在tbody标签(也有thead)内?_Html_Css - Fatal编程技术网

Html 如何将图像居中放置在tbody标签(也有thead)内?

Html 如何将图像居中放置在tbody标签(也有thead)内?,html,css,Html,Css,HTML: 如您所见,图像在表格中没有居中(但在左侧有一点): 我如何做到这一点 代码笔:将colspan=“2”添加到 将colspan=“2”添加到 试试这个: 试试这个: <table> <thead> <tr> <th> Column 1 </th> <th> Column 2 </th>

HTML:

如您所见,图像在表格中没有居中(但在左侧有一点):

我如何做到这一点

代码笔:

将colspan=“2”添加到


将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>