Rob*_*ght 11 css css-selectors
何浩,
使用CSS时.如果a的CSS样式是相同的:链接a:访问a:hover a:active确实需要将它写出来.使用自定义链接.
.DT_compare a:link {
font-family:"Lucida Grande", Arial, sans-serif;
font-size:11px;
line-height:14px;
font-weight:normal;
font-style:normal;
color:#EEE;
text-align:center;
}
Run Code Online (Sandbox Code Playgroud)
任何捷径?
奇妙
Bol*_*ock 14
忘记伪类,只选择a
:
.DT_compare a {
font-family:"Lucida Grande", Arial, sans-serif;
font-size:11px;
line-height:14px;
font-weight:normal;
font-style:normal;
color:#EEE;
text-align:center;
}
Run Code Online (Sandbox Code Playgroud)
这不是一个非常具体的选择器; 如果有必要,你可以找到一些其他方法来增加它,以便它取代你a:hover
和a:active
选择器,或者改为使用whoughton的答案,并指定所有四个.
然后,如果您的主要超链接样式适用于它们之前a:hover
和之后a:active
没有任何内容,只要您将.DT_compare a
规则放在它们下面,它应该可以正常工作.
who*_*ton 14
我认为你不能做任何短于:
.DT_compare a:link,
.DT_compare a:visited,
.DT_compare a:hover,
.DT_compare a:active, {
font-family:"Lucida Grande", Arial, sans-serif;font-size:11px;line-height:14px;font-weight:normal;font-style:normal;color:#EEE;text-align:center; }
Run Code Online (Sandbox Code Playgroud)