CSS偽類別選取器active類比JavaScript點擊事件

來源:互聯網
上載者:User

標籤:css

一、說明

設定元素在被使用者啟用(在滑鼠點擊與釋放之間發生的事件)時的樣式。

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>

CSS偽類別選取器active類比JavaScript點擊事件

本文出自 “不知不問” 部落格,請務必保留此出處http://mazey.blog.51cto.com/12997993/1948121

CSS偽類別選取器active類比JavaScript點擊事件

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.