请问css3的transition属性可否被子元素继承?
问题描述
如题,就是给父元素设置上transition,那么子元素会有transition么?
在w3c规范里是否有这个的规范?能否给个链接
问题解答
回答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的完成状态(完成后移除?我注)。例如:
<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. mysql 查询身份证号字段值有效的数据2. python - 爬虫模拟登录后,爬取csdn后台文章列表遇到的问题3. mysql - 把一个表中的数据count更新到另一个表里?4. javascript - 弹出一个子窗口,操作之后关闭,主窗口会得到相应的响应,例如网站的某些登录界面,django后台的管理等,这是怎么实现的呢?5. 视频文件不能播放,怎么办?6. 请教使用PDO连接MSSQL数据库插入是乱码问题?7. mysql - 分库分表、分区、读写分离 这些都是用在什么场景下 ,会带来哪些效率或者其他方面的好处8. python bottle跑起来以后,定时执行的任务为什么每次都重复(多)执行一次?9. android - 分享到微信,如何快速转换成字节数组10. visual-studio - Python OpenCV: 奇怪的自动补全问题
