【发布时间】:2018-11-23 04:58:11
【问题描述】:
我有两个显示数据库数据的表。
现在我为标题设置第一个表,为数据设置第二个表。
我是这样设置的
<table class="t_status">
<td>No</td>
<td>Name</td>
<td>Address</td>
</table>
在表#2中
<table class="t_status">
<td>1</td>
<td>Michael</td>
<td>California</td>
<tr>
<td>2</td>
<td>Greg</td>
<td>LA</td>
现在面临数据显示时的问题,表1和表2设置不同的宽度。
这是CSS
table
{
empty-cells: show;
border-collapse: collapse;
width: 100%;
}
.t_status
{
border-collapse: collapse;
background: #fff;
border: 1px solid #d9d9d9;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;
width: 100%;
margin-top: -1px;
}
.t_status td, th
{
border-top: 1px solid #c0c0c0;
border-bottom: 1px solid #c0c0c0;
border-left: 1px solid #c0c0c0;
border-right: 1px solid #c0c0c0;
padding: 10px;
font-size: 40pt;
font-weight: bold;
}
.t_status td
{
color: #fff;
background-color: #000;
}
.t_status th
{
font-size: 40pt;
color: #fff;
}
【问题讨论】:
-
为什么要用两张表?标题使用
th -
@Morpheus 或者最好的 -
thead -
我用了2个表,之后会使用marquee,所以当数据在marquee中时,表头会固定在顶部
-
所以你可以在标题后面插入
<tr><td colspan="3">yourmarquee<td></tr>。或者,也许我不明白什么? jsfiddle.net/eV7M5/2
标签: html css html-table