首页 > 解决方案 > 带有关闭按钮的动画搜索表单

问题描述

我想使用 w3schools 示例中的动画搜索表单

input[type=text] {
  width: 130px;
  box-sizing: border-box;
  border: 2px solid #ccc;
  border-radius: 4px;
  font-size: 16px;
  background-color: white;
  background-image: url('searchicon.png');
  background-position: 10px 10px; 
  background-repeat: no-repeat;
  padding: 12px 20px 12px 40px;
  -webkit-transition: width 0.4s ease-in-out;
  transition: width 0.4s ease-in-out;
}

input[type=text]:focus {
  width: 100%;
}
<form>
  <input type="text" name="search" placeholder="Search..">
</form>

问题是它没有关闭按钮,我如何插入只有在展开后才可见的关闭位?

标签: htmlcssanimationbuttonsearch

解决方案


推荐阅读