答案 0 :(得分:3)
IF 边框设置为TD
内部元素
tr td:first-child {
padding-left:25px;
}
tr td:last-child {
padding-right:25px;
}
否则 一个很好的方法就是在一个内部使用透明表 灰色DIV ,其中包含您需要的填充
.tableContainer{
padding:15px;
position:relative;
margin:0 auto;
background:#353033;
border:1px solid #000;
box-shadow:0 5px 15px rgba(0,0,0,0.3);
}
table{
color:#B3B3B3;
table-layout:fixed;
border-collapse:collapse;
width:100%;
}
td, th{
text-align:left;
padding:5px 0;
border-bottom: 1px solid #000;
}
/* --------------------- */
html, body{
height:100%;
}
body{
font: 16px/1 sans-serif;
color: #fff;
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#6da5ce+0,9c7bac+50,ec8e99+100 */
background: #6da5ce; /* Old browsers */
background: -moz-linear-gradient(45deg, #6da5ce 0%, #9c7bac 50%, #ec8e99 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left bottom, right top, color-stop(0%,#6da5ce), color-stop(50%,#9c7bac), color-stop(100%,#ec8e99)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(45deg, #6da5ce 0%,#9c7bac 50%,#ec8e99 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(45deg, #6da5ce 0%,#9c7bac 50%,#ec8e99 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(45deg, #6da5ce 0%,#9c7bac 50%,#ec8e99 100%); /* IE10+ */
background: linear-gradient(45deg, #6da5ce 0%,#9c7bac 50%,#ec8e99 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6da5ce', endColorstr='#ec8e99',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
}
<div class="tableContainer">
<table>
<tr>
<th>Title</th>
<th>Title</th>
</tr>
<tr>
<td>Text goes here</td>
<td>and here also</td>
</tr>
</table>
</div>
答案 1 :(得分:0)
.tableContainer {
padding: 15px 0px;}
td, th {
padding: 5px 10px;}