我試圖淡入淡出編輯元素在CSS中的元素。特別是將border
從solid
更改爲dotted
,通過淡化更改,我該怎麼做?如何淡入改變CSS中的元素
編輯:
也許我需要更具體的瞭解方面,這裏是我當前的代碼:
li {
font-family: 'Roboto', sans-serif;
font-size: 20px;
color: black;
border-bottom: 1px solid black;
}
li:hover {
border-bottom: 1px dotted black;
opacity: 1;
transition: opacity 1s ease-in-out;
}
一般情況下,使用'transition'。但是你不能'過渡''border-style'屬性,對不起。你需要第二個元素,你可以交叉淡化它... –
一些屬性不能褪色,但通常你可以使用'transition:all ease 1s',其中'1s'表示衰減以秒爲單位發生的持續時間。我將使用'pseudo-element'並將'opacity'轉換爲':hover'而不是 –
[這是一個交叉淡入淡出的示例](https://jsfiddle.net/23r0psjc/),使用僞元素。 –