导航菜单加上一些css3的过渡技术后可以产生更华丽的视觉效果,将基本知识小结如下:
transition-property属性+transition-duration属性:
一个产生hover平滑效果,一个指定效果持续时间,两个进行配合;
其中property的值为可以为width,none,all等,也可以是属性列表;
duration的值是时间,以秒为单位,默认为0,因此若要产生效果要>0;
代码块:
<style> div { width:100px; height:100px; background:blue; transition-property: width; transition-duration: 2s; } div:hover { width:300px; } </style>
在div:hover中指定最后宽度;
可以加上transition-delay属性,具有延迟反应的效果;