【发布时间】:2018-12-17 12:58:29
【问题描述】:
我正在尝试创建一个表头位于左侧且内容位于同一行且宽度相同的表格。
我尝试的结果在下面的代码 sn-p 中。单元格内容没有达到合理的单元格大小,它只是呈现为一条很长的水平线(而不是分成几行)。
.table-demo {
text-align: center;
border-collapse: collapse;
table-layout: fixed;
overflow: visible;
display: table;
}
.table-demo tr {
display: inline-block;
}
.table-demo th, td {
display: block;
/*width:100%;*/
border: 1px solid;
}
.wrapper {
/*overflow-x: auto;*/
white-space: nowrap;
max-width:600px;
}
<div class=" col-md-10 wrapper " >
<table class="table table-responsive table-demo" width="100%;">
<tr>
<th>
Spec
</th>
<th>
Spec 2
</th>
<th>
Tect de
</th>
<th>
Price
</th>
<th>
Terms
</th>
</tr>
<tr>
<td>
with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</td>
<td>
Offertext 2
</td>
<td > Lorem Ipsum is simply dummy text of the printing and t versions of Lorem Ipsum.
</td>
<td>
<p>789.00</p>
</td>
<td>
+40
</td>
</tr>
<tr>
<td>
with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</td>
<td>
Offertext 2
</td>
<td > Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
</td>
<td>
<p >999.00</p>
</td>
<td>
30
</td>
</tr>
<tr>
<td>
Lorem Ipsum issoftware like Aldus PageMaker including versions of Lorem Ipsum.
</td>
<td>
Offertext 2
</td>
<td > Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a type
specimen book. It has survived not only five centuries, but also the leap into
electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release
of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like
Aldus PageMaker including versions of Lorem Ipsum.
</td>
<td>
811.00
</td>
<td>
30
</td>
</tr>
</table>
</div>
我希望它:
一个。适合 bootstrap 10 列的表格。
b.所有单元格都具有相同的宽度。
c。长文本来阻止多行。
【问题讨论】:
标签: html-table css-tables