:hover
hover
、active
、focus
:hover
a:hover
a.class:hover
a:hover
{
color
:
yellow
;
background
:
blue
;
font-size
:
small
;
}
p:hover
{
color
:
yellow
;
background
:
blue
;
font-size
:
large
;
}
div:hover
{
color
:
red
;
background
:
lime
;
font-size
:
small
;
}
IE6、IE7(Q)、IE8(Q)瀏覽器不支持A元素以外的其它元素的:hover偽類,可通過上面的示例測試
CSS提供了四種偽類設置鏈接的顏色,包括:link、:visited、:hover、:active,它們的聲明是有一定順序的,我們將這種順序簡稱為L-V-H-A,即link最先,其次visited,之后hover,最后active,如此聲明才能保證hover與active狀態(tài)顯示正確的樣式
a:link
{
color
:
red
;
}
a:visited
{
color
:
green
;
}
a:hover
{
color
:
blue
;
}
a:active
{
color
:
black
;
}
選擇符 | IE6 | IE7 | IE8 | IE9 | FF | CH | OP | SA |
---|---|---|---|---|---|---|---|---|
E:hover | part | part | part | yes | yes | yes | yes | yes |
新聞熱點
疑難解答