0048:フォーカス - 要素がフォーカスを受け取ります

:フォーカス擬似クラスセレクタ:要素ゲインフォーカスを選択します。私たちは、フォーム要素のために主にここにいます。

:ホバー

構文:

.total input {
  border: 1px solid #ccc;
  height: 30px;
  width: 40px;
  transition: all .5s;
}
/*这个input 获得了焦点*/
.total input:focus {
  width: 80px;
  border: 1px solid skyblue;
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
    input {
        outline: none;
    }
    input:focus {
        background-color: pink;
        border: 1px solid red;
        height: 50px;
    }
    </style>
</head>
<body>
    <input type="text">
</body>
</html>
.page_skip input {
    width: 46px;
    height: 36px;
    border: 1px solid #ccc;
    text-align: center;
    /*过渡写在本身上 谁做动画,给谁加*/
    transition: all 0.3s;
}
/*表单获得焦点后 */
.page_skip input:focus {
    width: 88px;
    border: 1px solid skyblue;
}

おすすめ

転載: www.cnblogs.com/jianjie/p/12127069.html