【发布时间】:2012-08-15 20:56:24
【问题描述】:
我正在尝试在我的 CSS(眨眼)中练习 DRY,但我一直不知道如何解决这个问题。
如何减少这种情况:
table.shipmentItemList TD.title,
table.shipmentItemList TD.author,
table.shipmentItemList TD.options {
font-size: 1.0em;
font-weight: normal;
}
这样的:
table.shipmentItemList TD.title, TD.author, TD.options {
font-size: 1.0em;
font-weight: normal;
}
或者更好的是:
table.shipmentItemList TD .title, .author, .options {
font-size: 1.0em;
font-weight: normal;
}
【问题讨论】:
-
如果你想在 CSS 中做这种事情,你将不得不研究 LESS 或 SASS。由于您的代码采用标准 CSS,因此它尽善尽美。
标签: css css-selectors