亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

具有多個屬性的CSS過渡簡寫?

具有多個屬性的CSS過渡簡寫?

慕娘9325324 2020-02-04 15:59:27
我似乎找不到具有多個屬性的CSS過渡速記的正確語法。這沒有做任何事情:.element {  -webkit-transition: height .5s, opacity .5s .5s;     -moz-transition: height .5s, opacity .5s .5s;      -ms-transition: height .5s, opacity .5s .5s;          transition: height .5s, opacity .5s .5s;  height: 0;  opacity: 0;  overflow: 0;}.element.show {  height: 200px;  opacity: 1;}我用javascript添加了show類。元素變得更高且可見,它只是不過渡。在最新的Chrome,FF和Safari中進行測試。我究竟做錯了什么?編輯:為了清楚起見,我正在尋找簡化我的CSS的簡寫版本。使用所有供應商前綴已經足夠enough腫。還擴展了示例代碼。
查看完整描述

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>


查看完整回答
反對 回復 2020-02-04
?
慕斯709654

TA貢獻1840條經驗 獲得超5個贊

我與這個工作:


element{

   transition : height 3s ease-out, width 5s ease-in;

}


查看完整回答
反對 回復 2020-02-04
  • 3 回答
  • 0 關注
  • 471 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號