首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >忽略表数据之间的间隙

问忽略表数据之间的间隙
EN

Stack Overflow用户
提问于 2018-02-09 22:50:13
回答 2查看 44关注 0票数 0

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

​

​

这是表的一些代码(我不会把它全部张贴出来,因为它是重复的,所有的标签在末尾也是封闭的)。

我试着改变了填充和边距,但它不起作用。这是CSS:

​

代码语言:javascript
复制
/*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;
}
代码语言:javascript
复制
<table style="width:100%">
  <tr>
    <td><label><input type="checkbox" name="example" value="Value"><span><b>Voice over artist</b> &ensp; &euro;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>&ensp; &euro;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> &ensp; &euro;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>&ensp; &euro;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>

​

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2018-02-09 23:40:08

首先,你有一些div在html中做的不多(div有第二行),当你使用表时,tr标签自动定义行,所以你不需要放一个div来说那是我的第一行,等等……

使用大量的空白处,到处填充会让你的表格看起来很难看,这取决于你使用的浏览器,我试着重组你的代码,并在你的css中添加了以下内容:

代码语言:javascript
复制
td{
  padding : 20px
}
table{
  margin: 0 auto;
}

现在你所要做的就是使用填充来改变你想要的空间。如果您想要更大的表格,也可以更改表格的宽度。这是一个jsfiddle:

https://jsfiddle.net/rfroq680/2/

票数 0
EN

Stack Overflow用户

发布于 2018-02-09 22:54:18

我最近有了这个,你需要在css中使用边界间距。

试试这个:

代码语言:javascript
复制
table{
    border-collapse:separate; 
    border-spacing:0 6px;    

}

使用上面的代码,行之间的像素将达到6px。

这也应该会有帮助:https://www.w3schools.com/cssref/pr_border-spacing.asp

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48708402

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档