3 回答

TA貢獻1827條經驗 獲得超9個贊
如果您有想要以同樣的方式過渡幾個特定的屬性(因為你也有你特別一些屬性并不想轉型,比方說opacity),另一種選擇是做這樣的事情(略去了前綴):
.myclass {
transition: all 200ms ease;
transition-property: box-shadow, height, width, background, font-size;
}
第二個聲明會覆蓋其all上方的簡短聲明中的,并(有時)使代碼更簡潔。
/* prefixes omitted for brevity */
.box {
height: 100px;
width: 100px;
background: red;
box-shadow: red 0 0 5px 1px;
transition: all 500ms ease;
/*note: not transitioning width */
transition-property: height, background, box-shadow;
}
.box:hover {
height: 50px;
width: 50px;
box-shadow: blue 0 0 10px 3px;
background: blue;
}
<p>Hover box for demo</p>
<div class="box"></div>
- 3 回答
- 0 關注
- 471 瀏覽
相關問題推薦
添加回答
舉報