我有以下HTML結構:如何專注於HTML的輸入與CSS
<span id="span_pagination_text_input">
<input type="text" class="form-control" id="pagination_text_input" name="pagination_text_input"/>
...
</span>
並按照CSS:
span#span_pagination_text_input{
position:relative;
}
span#span_pagination_text_input > input#pagination_text_input{
left: -11px;
position: absolute;
top: -35px;
width: 57px;
z-index: 10;
display:none;
text-align:center
}
span#span_pagination_text_input:hover > input#pagination_text_input{
display:block;
}
在當遊客懸停在我的span
我會告訴input
場這個時間,這在默認情況下隱藏。
當我用CSS顯示時,我如何關注input
span
的孩子?
我瞭解jQuery,但是現在我正在尋找CSS解決方案。
你不能在CSS中做到這一點。 –
你可以使用像輸入一樣的CSS:focus { background-color:yellow; } –
或使用https://css-tricks.com/snippets/css/glowing-blue-input-highlights/ –