直接写 a { text-decoration: none; } 通常即可去除表格内链接下划线,但需注意框架覆盖、状态选择器(a:link/a:visited)、作用范围及继承干扰等问题。

直接给表格内 a 标签写 a { text-decoration: none; } 通常就生效
浏览器对 @#@#@#@#@#@#@#@#@#@0,确实能立刻生效,但问题明显:
- 每条链接都要重复写,维护成本高
- 无法统一控制 hover/focus 状态,可访问性差(键盘用户可能看不到焦点样式)
- 若表格数据由 JS 动态生成,容易漏掉或写错属性名
仅建议在调试阶段快速验证是否是样式问题,上线前务必移除。
遇到失效?先检查 text-decoration-line 是否被误用
有些人在查资料时看到 text-decoration-line: none 就照搬,但它不是独立属性,必须配合 text-decoration 使用(如 text-decoration: underline solid currentColor),单独写 text-decoration-line 不起作用,且多数浏览器不支持该写法。
真正需要精确控制时(比如只去下划线、保留其他装饰),应使用:
a:link,
a:visited {
text-decoration: none;
}
但绝大多数场景,text-decoration: none 足够了。别为了“看起来更细粒度”而引入冗余代码。
最容易被忽略的是:表格里嵌套了 <span></span> 或 <div> 包裹链接,而父元素设置了 <code>text-decoration: underline ——这时子链接的 none 会被继承链干扰,得加 text-decoration: none !important 或重构结构。
a {
text-decoration: none;
text-decoration-line: none; /* 辅助声明,非必需 */
}











