a標籤的css樣式中的四個狀態

來源:互聯網
上載者:User
這篇文章主要介紹了關於a標籤的css樣式中的四個狀態,有著一定的參考價值,現在分享給大家,有需要的朋友可以參考一下

a標籤有四個“狀態”的先後過程是:a:link ->a:hover ->a:active ->a:visited。另外,a:active不能設定有無底線(總是有的),下面有個樣本大家可以看看

表示所有狀態下的串連 如 a{color:red}
① a:link:未訪問連結 ,如 a:link {color:blue}
② a:visited:已訪問連結 ,如 a:visited{color:blue}
③ a:active:啟用時(連結獲得焦點時)連結的顏色 ,如a:active{color:blue}
④ a:hover:滑鼠移到連結上時 ,如 a:hover {color:blue}
一般a:hover和a:visited連結的狀態(顏色、底線等)應該是相同的。
前三者分別對應body元素的link、vlink、alink這三個屬性。
四個“狀態”的先後過程是:a:link ->a:hover ->a:active ->a:visited。另外,a:active不能設定有無底線(總是有的)。
舉例:偽類的常見狀態值

<style type = “text/css”> a {font-size:16px} a:link {color: blue; text-decoration:none;} //未訪問:藍色、無底線 a:active:{color: red; } //啟用:紅色 a:visited {color:purple;text-decoration:none;} //已訪問:purple、無底線 a:hover {color: red; text-decoration:underline;} //滑鼠移近:紅色、底線 </style>

以上就是本文的全部內容,希望對大家的學習有所協助,更多相關內容請關注topic.alibabacloud.com!

相關文章

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.