我想知道以下哪个例子会更好.如果性能相同,哪一个读得更好?
示例1(重复选择器)
.helpfulCommenter, .questionTroll {
color: #f00;
}
.questionTroll { text-decoration: line-through; }
.helpfulCommenter { color: #f00; }
.questionTroll { color: #f00; text-decoration: line-through; }
.helpfulCommenter, .questionTroll {
color: #f00;
}
.questionTroll { text-decoration: line-through; }
要么
示例2(重复样式)
.helpfulCommenter { color: #f00; }
.questionTroll { color: #f00; text-decoration: line-through; }
.helpfulCommenter, .questionTroll {
color: #f00;
}
.questionTroll {
text-decoration: line-through;
}
.helpfulCommenter { color: #f00; }
.questionTroll { color: #f00; text-decoration: line-through; }
我知道类名不是语义,这里展示的特定样式是无关紧要的.我只是想知道哪些浏览器更容易解析和实现.
css ×1