2016-09-29 116 views
2

首先感謝你。css更改輸入光標/光標顏色

我想實現這樣的功能:(用於<input>節點)

  1. 佔位符文本的顏色是:#b8b9b9

  2. 的輸入文字的顏色:#4e5050

  3. 輸入插入符的顏色爲:#FF0000

我已經實現了前兩個特點1和2,代碼:

input[type='text']::-webkit-input-placeholder{ 
    color: #b8b9b9; 
} 
input[type='text']:-moz-placeholder{ 
    color: #b8b9b9; 
} 
input[type='text']::-moz-placeholder{ 
    color: #b8b9b9; 
} 
input[type='text']:-ms-input-placeholder{ 
    color: #b8b9b9; 
} 
input[type='text']:focus { 
    color: #4e5050; 
} 

但我不知道如何實現該功能,3。

我已經嘗試Styling text input caret, 上的功能,但這不適用於移動Safari瀏覽器。移動Safari瀏覽器輸入插入符號的顏色已經是iPhone的默認顏色:藍色

+1

已經有這個 http://stackoverflow.com/questions/7339333/styling-text-input-caret –

+0

感謝的答案,但如果我指定它不會爲移動Safari瀏覽器 – zctocm

回答

-2

你可以通過這個選項

div { 
    cursor: url(YOUR_IMAGE_URL), auto; 
} 
+0

工作圖像具有固定的寬度和高度,當我改變輸入高度時,光標圖像高度將適合輸入節點的高度? – zctocm

+1

遊標是**鼠標指針**,如果我理解正確,你正在尋找**符號**([眨眼線](http://i.stack.imgur.com/lPX6Z .jpg))顏色。 –

+0

是的,脫字符的顏色 – zctocm

3

使用現代CSS圖像分配給任何元素光標!

input { 
    caret-color : #FF0000; 
}