首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >设置html表格td的宽度

问设置html表格td的宽度
EN

Stack Overflow用户
提问于 2012-07-24 02:25:48
回答 1查看 56关注 0票数 0

我有以下代码:

代码语言:javascript
复制
<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

代码语言:javascript
复制
 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;}​

为什么我不能设置宽度?背景颜色也没有改变,所以我肯定有一个代码错误。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-07-24 02:27:45

类名不能以数字开头。尝试重命名您的类以字母(a-z)开头。

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

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11618262

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档