對於簡單的輸入文本框,我使用以下樣式,並且我想讓虛線邊框動起來以實現焦點,反之亦然。輸入[type = text]轉換延遲不起作用
input {
font-family: inherit;
font-size: large;
border: 2px solid #1bd55a;
border-radius: 5px;
}
input[type=text] {
width: 500px;
height: 30px;
color: #616161;
padding-left: 6px;
border-style: dashed;
background-color: rgba(27, 213, 90, 0.12);
transition: 0.3s;
}
input[type=text]:focus {
border-style: solid;
outline: none; /* gets rid of the blue outline. */
}
但是,使用當前代碼,虛線和實體之間的過渡是立即的,在那裏沒有動畫。我爲單個屬性設置動畫,並且我知道可以使用svg的stroke
屬性進行此項工作,那麼如何正確地將它應用於文本輸入?