html - 无法将 css 应用于两个不同的表

标签 html css css-tables

我想创建两个不同风格的表格

我使用了两个类并以不同的方式命名它们但是在为 css 编码之后 要么 css 不起作用,要么两个表都应用了相同的 css 样式。

例如:如果我为第一个表设置了边界线,它也会应用到另一个表。

The Code

最佳答案

table.ssc table,th,td {
  properties...
}

您所定位的“th”和“td”选择器并不具体,这就是样式被应用于两个表格的原因。在这里您可以更具体地了解选择器,例如

.ssc td,
.ssc th,
.ssc.table {}

.hsc td,
.hsc th,
.hsc.table {}

希望对你有帮助

关于html - 无法将 css 应用于两个不同的表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59509934/

相关文章:

html - 导入特定 Material 图标

php - 我尝试连接到 xampp 数据库但失败

css - 如何在我自己的级别选择特定的 div

html - 如何在表格单元格中添加三 Angular 形

html - 使用表模型的 Flexbox 间隔行为

html - Google map 集成中出现“rd 未定义”错误

html - css 背景颜色在 Firefox 中不起作用

html - 带有 :visited 的样式兄弟选择器

css - @media 有问题(最小宽度 : XXXpx) working for one id but not the other

php - 为什么这个标准的正则表达式不能在 PHP ereg 函数中工作