簡體   English   中英

設置html表的寬度td

[英]setting the width of a html table td

我有以下代碼:

<table>
 <thead>
    <th class='1'>Date</th>
    <th class='2'>Start Time</th>
    <th class='3'>End Time </th>
    <th class='4'>Location</th>
</thead>
  <tbody>
    <td class='1'>Date</td>
    <td class='2'>Start Time</td>
    <td class='3'>End Time </td>
    <td class='4'>Location</td>
</tbody>
</table>​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

和css

 table {width:550px;}
​.1 {width:60px; background-color:green;}
.2 {width:90px; background-color:blue;}
.3 {width:90px; background-color:red;}
.4 {width:100px; background-color:yellow;}​

為什么我不能設置寬度? 背景顏色也沒有改變,所以我必須有一個代碼錯誤。

類名不能以數字開頭。 嘗試重命名您的類以開始一個字母(az)。

JS小提琴: http//jsfiddle.net/sDKp2/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM