小智 13
试试这个解决方案
<div class="cursor">
<input type="text" class="rq-form-element" />
<i></i>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS
.cursor {
position: relative;
}
.cursor i {
position: absolute;
width: 1px;
height: 80%;
background-color: gray;
left: 5px;
top: 10%;
animation-name: blink;
animation-duration: 800ms;
animation-iteration-count: infinite;
opacity: 1;
}
.cursor input:focus + i {
display: none;
}
@keyframes blink {
from { opacity: 1; }
to { opacity: 0; }
}
Run Code Online (Sandbox Code Playgroud)
现场演示 - https://jsfiddle.net/dygxxb7n/
Cha*_*ali 10
只需添加autofocus属性.请点击此处链接
<input type="text" class="rq-form-element" autofocus/>
Run Code Online (Sandbox Code Playgroud)
该autofocus属性是一个boolean属性.当存在时,它指定一个元素应该在自动获取focus时page loads.
| 归档时间: |
|
| 查看次数: |
28534 次 |
| 最近记录: |