
我的例子:
.Box { height: 300px; wIDth: 300px; background: #eeeeee; float: left; margin: 50px; -webkit-Transition: All 0.5s ease; -moz-Transition: All 0.5s ease; -o-Transition: All 0.5s ease; -ms-Transition: All 0.5s ease; Transition: All 0.5s ease;}.Box:hover { height: 350px;}#Box_pic1 { background: url(http://nicholsd.com/_Media/image-15_med.png); background-repeat: no-repeat; background-position: relative; height: 196px; wIDth: 262px; margin: 0 auto; margin-top: 20px;}.btn_ani { Font-size: 13px; text-align: center; color: #ffffff; opacity: 0.5; wIDth: 150px; background: #99745c; border:1px solID #99745c; line-height: 35px; Transition: opacity 0.5s; -webkit-Transition: all ease 0.5s; -moz-Transition: all ease 0.5s; -o-Transition: all ease 0.5s; -ms-Transition: all ease 0.5s; Transition: all ease 0.5s; position: absolute; margin-left: 56px;}.btn_ani:hover { background: #ffffff; color: #99745c; opacity: 1; -webkit-Transition: all ease 0.7s; -moz-Transition: all ease 0.7s; -o-Transition: all ease 0.7s; -ms-Transition: all ease 0.7s; Transition: all ease 0.5s; border:1px solID #99745c; margin-top: 80px;} <div > <a href="www.Google.com"> <div ID="Box_pic1"> <div >VIEw</div> </div> </a> </div>解决方法 它可以用CSS完成.您可以简单地将:悬停状态移动到父.Box,将目标移动到后代,例如:.Box:hover .btn_ani.
在这种情况下,元素可以有自己的过渡值.
.Box { height: 300px; wIDth: 300px; background: #eeeeee; float: left; margin: 50px; -webkit-Transition: all 0.5s ease; -moz-Transition: all 0.5s ease; -o-Transition: all 0.5s ease; -ms-Transition: all 0.5s ease; Transition: all 0.5s ease;}.Box:hover { height: 350px;}#Box_pic1 { background: url(http://nicholsd.com/_Media/image-15_med.png); background-repeat: no-repeat; background-position: relative; height: 196px; wIDth: 262px; margin: 0 auto; margin-top: 20px;}.btn_ani { Font-size: 13px; text-align: center; color: #ffffff; opacity: 0.5; wIDth: 150px; background: #99745c; border:1px solID #99745c; line-height: 35px; Transition: opacity 0.5s; /* different Transition from the parent */ -webkit-Transition: all ease 0.7s; -moz-Transition: all ease 0.7s; -o-Transition: all ease 0.7s; -ms-Transition: all ease 0.7s; Transition: all ease 0.7s; position: absolute; margin-left: 56px;}.Box:hover .btn_ani { background: #ffffff; color: #99745c; opacity: 1; border:1px solID #99745c; margin-top: 80px;} <div > <a href="www.Google.com"> <div ID="Box_pic1"> <div >VIEw</div> </div> </a> </div>总结
以上是内存溢出为你收集整理的html – 如何在css3中将类调用到另一个类?全部内容,希望文章能够帮你解决html – 如何在css3中将类调用到另一个类?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)