我已经在网站上建立了一个简单的表格-我在表格中使用了HTML代码-但是我无法弄清楚填充为何不起作用-我在模式中使用CSS和JS(我是初学者) 。我什至将padding设置为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">×</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">×</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">×</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>
如果有人可以提供任何建议,将不胜感激。
谢谢
答案 0 :(得分:-1)
我建议您为表格设置边距而不是填充,我希望它可以工作...
答案 1 :(得分:-1)
对于表格,您不能填充。对于'div'和其他元素,例如“ P,span”,您可以填充。对于表格使用cellpadding。 (如果您只想将border值设为1,则可以看到padding with border。)
答案 2 :(得分:-2)
是的,请使用边距而不是填充,并访问此网站以了解更多有关它们的信息: http://www.htmldog.com/references/css/properties/padding/