請(qǐng)問(wèn)css3的transition屬性可否被子元素繼承?
問(wèn)題描述
如題,就是給父元素設(shè)置上transition,那么子元素會(huì)有transition么?
在w3c規(guī)范里是否有這個(gè)的規(guī)范?能否給個(gè)鏈接
問(wèn)題解答
回答1:文檔地址: http://dev.w3.org/csswg/css-transitions/CRTL+F 查'inherited'結(jié)果都是NO.這些屬性包括:
transition-propertytransition-durationtransition-timing-functiontransition-delay Propertytransition Shorthand
關(guān)于繼承性,文檔中提到了一點(diǎn)
EXAMPLE 4An example where maintaining the set of completed transitions is necessary would be a transition on an inherited property, where the parent specifies a transition of that property for a longer duration (say, transition: 4s text-indent) and a child element that inherits the parent’s value specifies a transition of the same property for a shorter duration (say, transition: 1s text-indent). Without the maintenance of this set of completed transitions, implementations could start additional transitions on the child after the initial 1 second transition on the child completes.
這里提到了一個(gè)場(chǎng)景,如果parent指定的transition作用到的屬性和child指定的transtions作用到的屬性是同一個(gè),而且parent的transtion過(guò)渡時(shí)間更長(zhǎng),那么就需要自己去維護(hù)transition的完成狀態(tài)(完成后移除?我注)。例如:
<p class='parent'> <p class='child'></p></p>.parent { transition: 4s text-indent;}.child{ transition: 1s text-indent;}
如有錯(cuò)誤歡迎指正。
回答2:不能。我在谷歌下試了,不能。
回答3:不能 https://developer.mozilla.org/en-US/docs/Web/CSS/transition
相關(guān)文章:
1. javascript - 如何將一個(gè)div始終固定在某個(gè)位置;無(wú)論屏幕和分辨率怎么變化;div位置始終不變2. html - vue項(xiàng)目中用到了elementUI問(wèn)題3. javascript - 原生canvas中如何獲取到觸摸事件的canvas內(nèi)坐標(biāo)?4. javascript - vscode alt+shift+f 格式化js代碼,通不過(guò)eslint的代碼風(fēng)格檢查怎么辦。。。5. javascript - 求解答:實(shí)例對(duì)象調(diào)用constructor,此時(shí)constructor內(nèi)的this的指向?6. javascript - 有什么比較好的網(wǎng)頁(yè)版shell前端組件?7. java - 如何寫一個(gè)intellij-idea插件,實(shí)現(xiàn)編譯時(shí)修改源代碼的目的8. javascript - [js]為什么畫布里不出現(xiàn)圖片呢?在線等9. java 中Long 類型如何轉(zhuǎn)換成Double?10. html5 - 有可以一次性把所有 css外部樣式轉(zhuǎn)為html標(biāo)簽內(nèi)style=" "的方法嗎?
