CSS中表格第一行设置颜色 </tr>
<tablecalss="table"><tbody><tr><td>1</td><td>2</td><td>3</td><td>4</td><tdstyle="text...
<table calss="table">
<tbody> <tr> <td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td style="text-align: left;">5</td>
</tr>
<tr> <td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr> <td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr> <td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr> <td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr> <td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr> <td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr> <td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr> <td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr> <td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
</tbody>
</table>
这个是表格内容,只能用CSS定义的前提下,在CSS中设置
/*表格样式*/
table{
margin:0 auto;
border-collapse:collapse;
width:80%;
}
table tr{
line-height: 30px;
}
table td{
text-align: center;
border: 1px solid white;
}
table tr:nth-child(odd){
background: #FDE566;
}
会得到颜色间隔的表格,那么如果要让第一行,显示另外单独的颜色,从第二行开始颜色间隔排列,怎么弄? 展开
<tbody> <tr> <td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td style="text-align: left;">5</td>
</tr>
<tr> <td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr> <td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr> <td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr> <td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr> <td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr> <td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr> <td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr> <td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr> <td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
</tbody>
</table>
这个是表格内容,只能用CSS定义的前提下,在CSS中设置
/*表格样式*/
table{
margin:0 auto;
border-collapse:collapse;
width:80%;
}
table tr{
line-height: 30px;
}
table td{
text-align: center;
border: 1px solid white;
}
table tr:nth-child(odd){
background: #FDE566;
}
会得到颜色间隔的表格,那么如果要让第一行,显示另外单独的颜色,从第二行开始颜色间隔排列,怎么弄? 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询