selector-UI元素狀態偽類

來源:互聯網
上載者:User

結合CSS2.0和CSS3.0,UI元素狀態偽類共有以下幾個,仍然是結合執行個體來看.

代碼             效果
<html xmlns="http://www.w3.org/1999/xhtml"><head>    <title>無標題頁</title>    <style type="text/css">        *        {            margin:5px;        }    </style></head><body>    <a href="HTMLPage.htm">超級連結</a><br />    <a>超級連結</a><br />    <input type="checkbox" checked="checked" value="1" />男    <input type="checkbox" />女<br />    <input type="text" value="預設都是enabled" /><br />    <input type="text" value="disabled" disabled="disabled" />    <br />    <p>選中部分會高亮</p></body></html>
a:link{    color:Green;}
E:link
僅能在a對象上使用.用於設定a元素未被訪問時的樣式.
對於無href的a對象無效.
a:visited{    background-color:Silver;}
E:visited
僅能在a對象上使用.用於設定a元素訪問過後的樣式.
對於無href的a對象無效.
p:hover{    color:red;}
E:hover
設定滑鼠在對象上懸停時的樣式.
p:active{    color:Green;}
E:active
設定對象在被使用者啟用(在滑鼠點擊與釋放之間發生的事件)時的樣式.
input:focus{    background-color:Green;}
E:focus
設定元素在成為輸入焦點時的樣式.
input:checked{    height:40px;    width:40px;}
E:checked
設定元素被選中時的樣式.
input:enabled{    color:Red;}
E:enabled
設定使用者介面中處於可用狀態的E元素
input:disabled{    color:Red;}
E:disabled
設定使用者介面中處於停用E元素
p::selection{    color:Red;}
E::selection
匹配E元素中被使用者選中或處於高亮狀態的部分

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.