CSS を使用したアニメ付き検索フォームの作成方法を学習します。
入力フィールドをクリックしてください:
<input type="text" name="search" placeholder="Search..">
.input[type=text] {
width: 130px;
-webkit-transition: width 0.4s ease-in-out;
transition: width 0.4s ease-in-out;
}
/* When the input field gets
focus, change its width to 100% */
input[type=text]:focus {
width: 100%;
}
Try it Yourself »
HTML フォームをスタイルする方法の詳細については、CSS フォーム・チュートリアルをご覧ください。