選擇器(E:hover/E:active/E:focus的使用)

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <style type="text/css">
        input[type=text]:hover {
        background-color:limegreen;
        }
        input[type=text]:active {
        background-color:skyblue;
        }
        input[type=text]:focus{
        background-color:#00ff90;
        }
    </style>
</head>
<body>
<!-- E:hover
    選擇器被用來指定當鼠標指針移動到元素上時,元素所使用的樣式,方法以下:
    <元素>:hover
    {
      //指定樣式。
    }
     -->
    <!-- E:active
        選擇器被用來指定元素被激活(就是按下沒有釋放時)所使用的樣式。 -->
    <!-- E:focus
        選擇器被用來指定元素獲取焦點時所使用的樣式。 -->
    <form>
        <p>姓名:<input type="text" name="name" /></p>
        <p>地址:<input type="text" name="address" /></p>
    </form>
</body>
</html>css

效果以下:html

相關文章
相關標籤/搜索