我正在设计搜索栏的表单



这是HTML

<form class="search-form" action="index_submit" method="get" accept-charset="utf-8">
  <input type="search" name="search" placeholder="Search here...">
  <button type="submit"><i class="fa fa-search"></i></button>
  <div class="clearfix"></div>
</form>


这是我的CSS

.search {
   position: static;
}

.search-box {
   position: absolute;
   top: 50%;
   left: 50%;
}

.search-form input[type="search"] , .search-form button {
   outline: none;
   border: none;
   padding: 10px;
   margin: 0;
   float: left;
   color: black;
}

.search-form input {
   background-color: yellow;
}

.search-form button {
   text-align: center;
}


我遇到了光标在该文本字段中闪烁的问题。我希望该光标在垂直居中对齐。我已经给了padding但它不起作用,我想CSS自定义该光标。
谢谢。

最佳答案

尝试在搜索栏输入样式中添加“ text-align:center”。我不确定您是否要这样使光标不显示?如果那是您的意思,请查看此链接。

Hide textfield blinking cursor

10-07 19:37
查看更多