Learn how to create an animated search form with CSS.
Click on the input field:
<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 »
Tip: Go to our HTML Form Tutorial to learn more about HTML Forms.
Go to our CSS Forms Tutorial to learn more about how to style HTML Forms.
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!