为什么html表格单元格的边框颜色不变? [英] Why html table cell's border color does not change?

查看:441
本文介绍了为什么html表格单元格的边框颜色不变?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能让细胞的左边界变成红色?为什么这不起作用?谢谢!

How can I make left border of the cell red? Why this does not work? Thanks!!

<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上指定的颜色吗?

Shouldn't left-border override the color specified on .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>


推荐答案

将边框设置为 1px双红。 1px宽的double边框看起来与solid相同,但在折叠的边框计算中具有更高的优先级。

Set the border to 1px double red. A 1px-wide "double" border looks identical to a "solid", but has higher precedence in collapsed border computation.

这篇关于为什么html表格单元格的边框颜色不变?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆