我有一个表格,我想要的是不让内容之间的空间变得很大。这就是页面现在的样子:

这是表的一些代码(我不会把它全部张贴出来,因为它是重复的,所有的标签在末尾也是封闭的)。
我试着改变了填充和边距,但它不起作用。这是CSS:
/*styling the table for the add ons*/
table,
tr,
td,
input {
margin: 30px;
padding: 10px;
margin-right: 20px;
margin-left: 45px;
line-height: 1.4em;
font-size: 17px;
}
.pushRight {
position: relative;
left: 10px;
bottom: 75px;
}<table style="width:100%">
<tr>
<td><label><input type="checkbox" name="example" value="Value"><span><b>Voice over artist</b>   €475</span>
<table>
<tr>
<td class="pushRight">If you require a voice artist for your video project<br>please select this option.</td>
</tr>
</table>
</td>
<td><label><input type="checkbox" name="example" value="Text"><span><b>Creative Concept</b>  €1200</span>
<table>
<tr>
<td class="pushRight">We are bursting with ideas, so if you don't have one of<br>your own please select this option.</td>
</tr>
</table>
</td>
</div></tr>
<tr><div class="secondRow">
<td><label><input type="checkbox" name="example" value="Value"><span><b>Script</b>   €850</span></label>
<table>
<tr>
<td class="pushRight">If you would like us to allocate our scriptwriter to your project<br>please select this option.</td>
</tr>
</table>
</td>
<td><label><input type="checkbox" name="example" value="Text"><span><b>Storyboarding</b>  €875</span>
<table>
<tr>
<td class="pushRight">It is not essential to storyboard every video project, <br>however if you would like to include this process,<br>please select this option.</td>
</tr>
</table>
</td>
</div></tr>
发布于 2018-02-09 23:40:08
首先,你有一些div在html中做的不多(div有第二行),当你使用表时,tr标签自动定义行,所以你不需要放一个div来说那是我的第一行,等等……
使用大量的空白处,到处填充会让你的表格看起来很难看,这取决于你使用的浏览器,我试着重组你的代码,并在你的css中添加了以下内容:
td{
padding : 20px
}
table{
margin: 0 auto;
}现在你所要做的就是使用填充来改变你想要的空间。如果您想要更大的表格,也可以更改表格的宽度。这是一个jsfiddle:
发布于 2018-02-09 22:54:18
我最近有了这个,你需要在css中使用边界间距。
试试这个:
table{
border-collapse:separate;
border-spacing:0 6px;
}使用上面的代码,行之间的像素将达到6px。
这也应该会有帮助:https://www.w3schools.com/cssref/pr_border-spacing.asp
https://stackoverflow.com/questions/48708402
复制相似问题