本文介紹了CSS中的逗號,使用相同CSS的多個選擇器的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
.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*/ }
Tbl 和 Tbl2 的 CSS 應該相同.
where the CSS for Tbl and Tbl2 should be the same.
.Resource table.Tbl, table.Tbl2 td { /* some css*/ }
不起作用.
如何在不復制整行的情況下實現這一點?
How can I achieve this, without duplicating whole line?
推薦答案
.Resource table.Tbl td, .Resource table.Tbl2 td { /* some css*/ }
您應該為這兩個規則添加完整的祖先路徑.不只是你看到差異的地方.
You should add the full ancestor path for both rules. Not just where you see differences.
這篇關于CSS中的逗號,使用相同CSS的多個選擇器的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!