문제

How can I remove the caret from a <input type="text"> element only using CSS and not JavaScript?

도움이 되었습니까?

해결책

Of course you can do it just with CSS.

Add this code to your CSS file:

border: none;
color: transparent;
text-shadow: 0 0 0 gray;
text-align: center;

&:focus {
    outline: none;
}

Here you have the SOURCE and a DEMO

다른 팁

I can only say you that you can achieve this by applying the color through css :

<input type="text" style="color: transparent;text-shadow: 0 0 0 red;" />

FIDDLE DEMO

Otherwise there is no way to style the text cursor with CSS.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top