我只是想知道你是否不改变值,悬停,活动和焦点自动从标准标签继承设置?
例如:
.wrapper .left .main .row .holder .more a,#content .wrapper .left .main .row .holder .more a:visited { width: 92px; min-width: 92px; max-width: 92px; height: 23px; min-height: 23px; max-height: 23px; display: block; margin: 0px auto; background: #fff url(../images/more-info-btn.png) top left no-repeat; } #content .wrapper .left .main .row .holder .more a:hover { width: 92px; min-width: 92px; max-width: 92px; height: 23px; min-height: 23px; max-height: 23px; display: block; margin: 0px auto; background: #fff url(../images/more-info-btn.png) bottom left no-repeat; }
下面会做同样的事情吗?
#content .wrapper .left .main .row .holder .more a,#content .wrapper .left .main .row .holder .more a:visited { width: 92px; min-width: 92px; max-width: 92px; height: 23px; min-height: 23px; max-height: 23px; display: block; margin: 0px auto; background: #fff url(../images/more-info-btn.png) top left no-repeat; } #content .wrapper .left .main .row .holder .more a:hover { background: #fff url(../images/more-info-btn.png) bottom left no-repeat; }
解决方法
是的,这是正确的,伪状态继承值.
出于一致性目的,最好只在psuedo状态规则中声明要更改的样式.
使用以下代码,文本将始终为font-size:1.9em,填充顶部:10px,不管:悬停状态:
a { color:red; font-size:1.9em; padding-top:10px; } a:hover { color:green; }