一、說明
設置元素在被用戶激活(在鼠標點擊與釋放之間發生的事件)時的樣式。
IE7及更早瀏覽器只支持a元素的:active,從IE8開始支持其它元素的:active。
另:如果需要給超鏈接定義:訪問前,鼠標懸停,當前被點擊,已訪問這4種偽類效果,而又沒有按照一致的書寫順序,不同的瀏覽器可能會有不同的表現。超鏈接的4種狀態,需要有特定的書寫順序才能生效。注意,a:hover必須位於a:link和a:visited之后,a:active必須位於a:hover之后。可靠的順序是:l(link)ov(visited)e h(hover)a(active)te,即用喜歡(love)和討厭(hate)兩個詞來概括。Link
二、示例
<style>
.active-example{
width:100px;
height: 100px;
transition: all 1s ease-in-out;
background: red;
}
.active-example:active{
border-radius:50%;
background: blue;
}
</style>
<div class="active-example"></div>
