css自定义文本框实现input输入光标效果

1,076 阅读1分钟

主要代码

<div id="demo"></div>


#demo{
    position: relative;
}

#demo:after {
    position: absolute;
    content: '';
    display: inline-block;
    width: 2px;
    height: 18px;
    top: 50%;
    transform: translateY(-50%);
    animation: blink 1.2s infinite steps(1, start);
}

@keyframes blink {
    0%, 100% {
        background-color: #000;
    }
    50% {
        background-color: transparent;
    } 

}