1
我不确定为什么我的表格中的内容未对齐到左侧。这是一张图片:我想让'second'这个词坐在左边。这是我的HTML:表格对齐方式不起作用
<section>
<p>Test Number 6 </p>
<table>
<tbody>
<tr>
<td class="statusBlank"></td>
<td>second</td>
<td>0000-00-00 00:00:00</td>
<td class="tightcell"><a href="#">Download</a>
</tr>
<tr>
<td class="statusBlank"></td>
<td>second</td>
<td>0000-00-00 00:00:00</td>
<td class="tightcell"><a href="#">Download</a>
</tr>
<tr>
<td class="statusBlank"></td>
<td>second</td>
<td>0000-00-00 00:00:00</td>
<td class="tightcell"><a href="#">Download</a>
</tr>
<tr>
<td class="statusBlank"></td>
<td>second</td>
<td>0000-00-00 00:00:00</td>
<td class="tightcell"><a href="#">Download</a>
</tr>
</tbody>
</table>
<p>Final Project </p>
<table>
<tbody>
<tr>
<td class="statusBlank"></td>
<td>second</td>
<td>0000-00-00 00:00:00</td>
<td class="tightcell"><a href="#">Download</a>
</tr>
<tr>
<td class="statusBlank"></td>
<td>second</td>
<td>0000-00-00 00:00:00</td>
<td class="tightcell"><a href="#">Download</a>
</tr>
</tbody>
</table>
</section>
这里是我的SCSS(我用无礼的话):
/* ----TABLE---- */
section {
@include grid-row();
}
section p {
@include grid-column(12);
font-family: $font-stack;
font-size: 23px;
padding: 0;
margin: 0;
}
.button {
font-family: $font-stack;
color: #fff;
background-color: $secondary-color;
height: 27px;
text-align: center;
border-radius: 7px;
margin: 6px 0 5px 0;
padding: 5px 7px 5px 7px;
}
.button:hover {
background-color: $primary-color;
}
table {
@include grid-column(12);
padding: 0;
border-left: none;
border-right: none;
text-align:right;
border-collapse:separate;
border-spacing: 0 2px;
}
table {
tr {
background: #fff;
}
tr:hover {
background: #EBF7FC;
}
tr td {
padding:6px 8px;
}
tr td:first-child {
border-left: 3px solid #fff;
}
tr td:last-child {
border-right:3px solid #fff;
}
tr:hover td:first-child {
border-left: 3px solid $secondary-color;
}
tr:hover td:last-child {
border-right:3px solid $secondary-color;
}
}
.status {
color:#fff;
width: 33px;
padding: 5px 0;
text-align: center;
}
.statusRunning {
background-color: #5AD427;
@extend .status;
}
.statusQueued {
background-color: #A4E786;
@extend .status;
}
.statusIncomplete {
background-color: #FFCC00;
@extend .status;
}
.statusBlank {
}
table tr td:nth-child(2) {
text-align:left;
}
.tightcell a {
margin-right:25px;
color: $secondary-color;
}
什么我没有看到吗?
谢谢!
这是真的。但是,它会产生足够的差异吗?他没有设置单元格的宽度。 – Sparky
种类,因为默认情况下每个人会有25%的比例,你可以在图片中看到,没有太多内容。我会将你的建议添加到我的答案中。 – Skatox
我永远不会相信浏览器能够找出单元格的宽度......它们总是倾向于遍布整个地方,特别是当更宽的内容将它们向外推时。 – Sparky