請問css3的transition屬性可否被子元素繼承?
問題描述
如題,就是給父元素設置上transition,那么子元素會有transition么?
在w3c規(guī)范里是否有這個的規(guī)范?能否給個鏈接
問題解答
回答1:文檔地址: http://dev.w3.org/csswg/css-transitions/CRTL+F 查'inherited'結果都是NO.這些屬性包括:
transition-propertytransition-durationtransition-timing-functiontransition-delay Propertytransition Shorthand
關于繼承性,文檔中提到了一點
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.
這里提到了一個場景,如果parent指定的transition作用到的屬性和child指定的transtions作用到的屬性是同一個,而且parent的transtion過渡時間更長,那么就需要自己去維護transition的完成狀態(tài)(完成后移除?我注)。例如:
<p class='parent'> <p class='child'></p></p>.parent { transition: 4s text-indent;}.child{ transition: 1s text-indent;}
如有錯誤歡迎指正。
回答2:不能。我在谷歌下試了,不能。
回答3:不能 https://developer.mozilla.org/en-US/docs/Web/CSS/transition
相關文章:
1. 視頻文件不能播放,怎么辦?2. 前端 - 誰來解釋下這兩個 CSS selector 區(qū)別3. javascript - 求幫助 , ATOM不顯示界面!!!!4. javascript - ios返回不執(zhí)行js怎么解決?5. python - 爬蟲模擬登錄后,爬取csdn后臺文章列表遇到的問題6. html5 - HTML代碼中的文字亂碼是怎么回事?7. python bottle跑起來以后,定時執(zhí)行的任務為什么每次都重復(多)執(zhí)行一次?8. mysql - 分庫分表、分區(qū)、讀寫分離 這些都是用在什么場景下 ,會帶來哪些效率或者其他方面的好處9. javascript - vue2如何獲取v-model變量名10. javascript - angular使從elastichearch中取出的文本高亮顯示,如圖所示
