首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >为什么html表格单元格的边框颜色不变?

为什么html表格单元格的边框颜色不变?
EN

Stack Overflow用户
提问于 2012-01-18 14:55:09
回答 7查看 22K关注 0票数 20

怎样才能使单元格的左边框变红?为什么这不起作用?谢谢!!

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
.main-table {
    border-collapse: collapse;
}
.main-table td {
    margin: 0px;
    padding: 0px;
    border: 1px solid #aaa;
    padding: 1px 4px 1px 4px;
}
.left-border {
border-left: 1px solid red !important;
}
</style>
</head>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>

左边框不应该覆盖.main-table td上指定的颜色吗?

<table class='main-table' cellspacing='0' cellpadding='0'>
<tr>
    <td> 1 </td>
    <td> 366 </td>
</tr>
<tr>
    <td > 2 </td>
    <td class='left-border'> 777 </td>
</tr>
</table>

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

https://stackoverflow.com/questions/8906313

复制
相关文章

相似问题

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