input 输入框的光标颜色修改方法:
1. 根据字体颜色,即设置color,光标颜色会一起改变
<div class="custom-input">
<input id="custom-input" type="email" placeholder="请输入邮箱">
</div>
.custom-input input {
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
line-height: 40px;
font-size: 24px;
border: none;
border: 1px solid #eee;
border-radius: 4px;
margin: 10px 0 0 10px;
color: red;
}
2. css设置caret-color,光标颜色会变成指定颜色
@supports (caret-color: green) {
.custom-input input {
color: green;
caret-color: green;
}
}
但是 以上两个方法ios某些版本不支持,仍会是默认的蓝色光标