我現在有這個長期統治如何將nth-child()規則合併爲一個?
#content #wrapper table td:nth-child(3),
#content #wrapper table td:nth-child(4),
#content #wrapper table td:nth-child(5) {
width: 30px;
}
是有可能的第n個孩子結合起來,縮短東西像nth-child(3,4,5)
而不是3個獨立的線路?
我現在有這個長期統治如何將nth-child()規則合併爲一個?
#content #wrapper table td:nth-child(3),
#content #wrapper table td:nth-child(4),
#content #wrapper table td:nth-child(5) {
width: 30px;
}
是有可能的第n個孩子結合起來,縮短東西像nth-child(3,4,5)
而不是3個獨立的線路?
這應該做的伎倆:
#content #wrapper table td:nth-child(n+3):nth-child(-n+5) {
width: 30px;
}
不是我知道我害怕。如果你爲了使它更易於維護而尋找更少的代碼,你可以嘗試類似SASS的東西。
不是直接基於你的代碼,但這應該給你一個想法。
ul li:nth-child(n+3):nth-child(-n+7){ }
您可以嘗試
#content #wrapper table td:nth-child(n+3)
將所有選擇,但第一2.
這作品,非常感謝你!你能解釋最後一部分,我不知道它是如何工作的 – skyisred 2013-03-05 22:28:20
@skyisred你可能想玩這個http://lea.verou.me/demos/nth.html – Ana 2013-03-05 23:16:34