HTML5、CSS3实现旋转特效
生活随笔
收集整理的這篇文章主要介紹了
HTML5、CSS3实现旋转特效
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
利用CSS3的transiton屬性,進行控件的旋轉,并通過設置旋轉時間,實現特效。
效果連接:http://runjs.cn/detail/vkmy8obr
實例代碼:直接復制進html執行即可 無需引入其他文件
<style>.dh {width: 100px;height: 100px;position: relative;}.dh:before, .dh:after {content: "";width: 100px;height: 16px;border-radius: 8px;background-color: #000;position: absolute;transition: all 0.15s ease-in-out; /*設置旋轉持續時間*/-webkit-transition: all 0.15s ease-in-out;/*兼容性處理等同于上代碼*/}.dh:before {top: 0;box-shadow: 0 42px #000;}.dh:after {bottom: 0;}.dh:hover:before {top: 42px;box-shadow: none;transform: rotate(225deg);/*順時針旋轉225度*/-webkit-transition: rotate(225deg);/*兼容性處理等同于上代碼*/}.dh:hover:after {bottom: 42px;transform: rotate(135deg);/*順時針旋轉135度*/-webkit-transition: rotate(135deg);/*兼容性處理等同于上代碼*/}</style><div class="dh"> </div>總結
以上是生活随笔為你收集整理的HTML5、CSS3实现旋转特效的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: VUE 调用PC摄像头 全浏览器可用
- 下一篇: MAC平台卸载dnscrypt的方法