not*_*row 25 css css-selectors
.Resource table.Tbl td
{ /* some css*/ }
.Resource table.Tbl td.num
{ /* some css 2*/ }
.Resource table.Tbl td.num span.icon
{ /* some css 3*/ }
.Resource table.Tbl2 td
{ /* some css*/ }
.Resource table.Tbl2 td.num
{ /* some css 2*/ }
.Resource table.Tbl2 td.num span.icon
{ /* some css 3*/ }
Run Code Online (Sandbox Code Playgroud)
其中Tbl和Tbl2的CSS应该相同.
.Resource table.Tbl, table.Tbl2 td { /* some css*/ }
Run Code Online (Sandbox Code Playgroud)
不起作用.
如何在不重复整行的情况下实现这一目标?
Ali*_*aru 48
.Resource table.Tbl td, .Resource table.Tbl2 td { /* some css*/ }
Run Code Online (Sandbox Code Playgroud)
您应该为这两个规则添加完整的祖先路径.不只是你看到差异的地方.
ken*_*ytm 10
.Resource table.Tbl td, .Resource table.Tbl2 td { /* some css */ }
Run Code Online (Sandbox Code Playgroud)
你必须在之前和之后复制这些东西table.TblX
,因为没有办法将,
运算符分组为具有比后代选择器更高的优先级
.
你不能(不是在每个浏览器上,继续阅读).
不幸的是,每个选择器都是独立的.
这是CSS烦人的问题之一.
有:any()
,可以做你想要的,但浏览器支持是有限的.
您可以随意使用它并使用服务器端语言对其进行预处理,因此它会输出独立的选择器.
LESS很受欢迎.