首页 > 解决方案 > HTML表格填充不起作用

问题描述

我在我的网站上设置了一个简单的表格 - 我为表格使用了 HTML 代码 - 但我无法弄清楚为什么填充不起作用 - 我使用 CSS 和 JS 作为模态(我是初学者)。我什至将填充设置为 1000,但它什么也没做 - 图像彼此相邻。这是我的代码:

  <table width="500" border="0" cellpadding="5">

<tr>

<td align="center" valign="center">
<a href="https://www.londonontariomortgages.ca/first time home buyer program.html"> <img id="myImg" src="table/first time home buyer.jpg" alt="First Time Home Buyer Ontario" style="width:100%;max-width:300px"> </a>
<!-- The Modal -->
<div id="myModal" class="modal">
  <!-- The Close Button -->
  <span class="close">&times;</span>
  <!-- Modal Content (The Image) -->
  <img class="modal-content" id="img01">
  <!-- Modal Caption (Image Text) -->
  <div id="caption"></div>
</div>
<br />
<b>First Time Home Buyer Program<b>
</td>

<td align="center" valign="center">
<a href="https://www.londonontariomortgages.ca/renew my mortgage.html"> <img id="myImg" src="table/renewing your mortgage.jpg" alt="Renewing Your Mortgage" style="width:100%;max-width:300px"> </a>
<!-- The Modal -->
<div id="myModal" class="modal">
  <!-- The Close Button -->
  <span class="close">&times;</span>
  <!-- Modal Content (The Image) -->
  <img class="modal-content" id="img01">
  <!-- Modal Caption (Image Text) -->
  <div id="caption"></div>
</div>
<br />
<b>Renewing Your Mortgage<b>
</td>


<td align="center" valign="center">
<a href="https://www.londonontariomortgages.ca/Guide to Getting a Mortgage.html"> <img id="myImg" src="table/guide to getting a mortgage.jpg" alt="Guide to Getting a Mortgage in London Ontario" style="width:100%;max-width:300px"> </a>
<!-- The Modal -->
<div id="myModal" class="modal">
  <!-- The Close Button -->
  <span class="close">&times;</span>
  <!-- Modal Content (The Image) -->
  <img class="modal-content" id="img01">
  <!-- Modal Caption (Image Text) -->
  <div id="caption"></div>
</div>
<br />
<b>Guide to Getting a Mortgage<b>
</td>
</tr>
</table>   

如果有人可以提供任何建议,将不胜感激。

谢谢

标签: html

解决方案


对于表格,您不能提供填充。对于“div”和其他元素,例如“P,跨度”,您可以提供填充。对于表格使用单元格填充。(如果您想看到将边框值设置为 1,那么您可以看到带边框的填充。)


推荐阅读