css如何設定超連結樣式

來源:互聯網
上載者:User

  css設定超連結樣式是通過偽類來實現的

 

(1) :link:設定a對象在未被訪問前的樣式表屬性。

(2) :visited:設定a對象在其連結地址已被訪問過時的樣式表屬性。

(3) :hover:設定對象在其滑鼠移至上方時的樣式表屬性。

(4) :active:設定對象在被使用者啟用(在滑鼠點擊與釋放之間發生的事件)時的樣式表屬性。

  css中關於超連結的四個屬性正確順序為:


a:link {}
a:visited {}
a:hover {}
a:active {}

偽類名字對大小寫不敏感,但在定義順序上有要求。:hover必須被置於:link和:visited之後才是有效,:active必須被置於:hover之後才是有效。

 

  備忘

 

預設狀態下,建立的超級連結的文字顏色為藍色,並帶有底線,訪問之後變為紫色。如果想要修改這種顏色,需要用CSS樣式設定超級連結的a:link、a:visited、a:hover、a:active狀態的樣式。
執行個體

 

<style type=”text/css”> A{text-decoration:none} 無底線 A:link{color:red} A:visited{color:blue} A:active{color:yellow} A:hover{color:green;font-family:楷體;font-size:20} </style> 


 

 

文章轉載自:      css設定超連結樣式        http://www.studyofnet.com/news/222.html

 

相關文章

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.