我試圖結合使用僞選擇與僞元素來創建自定義工具提示。我可以在同一個元素上使用多個僞選擇器焦點嗎?
我的HTML:
<input id='test'/>
我的CSS:
#test {
position: relative;
}
#test:focus {
background-color: #08c;
}
#test:focus:before {
position: absolute;
left: 100%;
width: 10px;
height: 10px;
background-color: black;
}
運行代碼小提琴:http://jsfiddle.net/9ujEH/
目前集中時作爲#TEST結果輸入將變更爲藍色:重點,但黑色的方位不會像我以爲它會從#test:focus:before之前那樣出現。