我正在为搜索栏设计表单
这是 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;
}
我遇到了光标在该文本字段中闪烁的问题。我希望光标正好垂直居中对齐。我已经给出了填充,但它不起作用。我希望 CSS 自定义该光标。 谢谢。
最佳答案
尝试将“text-align: center”添加到您的搜索栏输入样式。我不确定你是不是想要它所以光标不显示?如果那是您的意思,请查看此链接。
关于html - 使用 CSS 在文本输入中设置光标样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26322687/