基于css3的属性transition制作菜单导航效果
来源:才华咖 本文已影响2.86W人
来源:才华咖 本文已影响2.86W人
导语:基于css3的属性transition制作菜单导航效果实例讲述了基于css3的属性transition制作菜单导航效果。下面本站小编分享给大家供大家参考。具体如下:
CSS3导航菜单,当你运动层在显示层下面时,transition会使页面产生闪动,原因是Chrome在初始渲染CSS动画时产生的Bug,虽然暂时无法考证这个问题的根本原因,但是目前已知的解决方案有两条:
-webkit-backface-visibility: hidden;(设置进行转换的元素的背面在面对用户时是否可见:隐藏)
-webkit-transform-style: preserve-3d; (设置内嵌的元素在 3D 空间如何呈现:保留 3D )。
运行效果截图如下:
具体代码如下:
代码如下:
<!DOCTYPE HTML>
<html lang=zh-cn>
<head>
<title>css3的属性transition制作菜单导航</title>
<style>
*{margin:0px;padding:0px;}
body{background:#45B5DA;margin:0px;padding:0px;}
{width:370px;margin:0 auto;line-height:24px;padding-top:10px;}
color{color:#fff;}
#nav{position:absolute;top:50%;left:50%;margin-top:-20px;margin-left:-185px;}
li{
width:74px;height:40px;text-align:center;float:left;line-height:40px;color:#fff;text-decoration:none;list-style:none;cursor : pointer;
}
li#chage{
width:70px;height:38px;display:block;position:absolute;left:0px;z-index:-1;border:2px solid #191919;
border-radius:10px;
background:-webkit-gradient(linear, 0 100%, 0 0, from(black), color-stop(0.5, black), color-stop(0.52,#313131), to(#6A6A6A));
box-shadow:0px 2px 0px rgba(255, 255, 255, .3);
-webkit-transform: translate(0px,0px);
-webkit-transition:-webkit-transform .2s ease-out;
}
</style>
</head>
<body>
<section class="tips">
当你运动层在显示层下面时,transition会使页面产生闪动,原因是Chrome在初始渲染CSS动画时产生的Bug,虽然暂时无法考证这个问题的根本原因,但是目前已知的`解决方案有两条:
-webkit-backface-visibility: hidden;(设置进行转换的元素的背面在面对用户时是否可见:隐藏)
-webkit-transform-style: preserve-3d; (设置内嵌的元素在 3D 空间如何呈现:保留 3D )
qq群:197326136
</section>
<section id="nav">
<li href="#" title="css3菜单,css3菜单导航">首页</li>
<li href="#" class="nav_2" onmouseover = "e(1);" onmouseout = "e(0);">脚本</li>
<li href="#" onmouseover = "e(2);" onmouseout = "e(0);">特效</li>
<li href="#" onmouseover = "e(3);" onmouseout = "e(0);">源码</li>
<li href="#" onmouseover = "e(4);" onmouseout = "e(0);">下载</li>
<li href="javascript:void(0);" id="chage"></li>
</section>
</body>
<script type="text/javascript">
function $(id){
return typeof id === "string" ? lementById(id) : id;
}
var zhj = {};
e = function(index){
var transX = 74*index;
$('chage')e['-webkit-transform'] = 'translate('+transX+'px,0px)';
}
</script>
</html>
希望本文所述对大家的css3网页设计有所帮助。
CSS的animation属性使用实例分析
Book5-Unit1Greatssientists的重点单词、词组整理
七年级Unit 4 Don’t eat in class. Section A说课稿
Chinas Liu to seek injury advice in US soon英语作文
六年级英语上册Unit2 New York is in the east of America说课稿
DOS的Interlnk、Intersvr、Qbasic命令使用说明
Passage Eighteen (Strictly Ban smoking)英语阅读理解
Scientists Build Robots to Live With Humans英语美文
英语教材分析:composition,analysis (unit 2)
Unit 13 Lesson50 Standing Room Only说课稿
Time To Stop Worrying About Invasive Species美文欣赏
Unit six Opening and Closing Ceremonies口译材料
分享SAT阅读练习题:Reading Comprehension Test 14
《the most interesting stories》湘少版六下Unit7的相关知识及
托福英语写作范文:Examinations exert a pernicious influence on educat
嘉宝果属于凉性还是热性水果
课题 8B Unit 5 International charities
Traditions of Chinese New Year为题目的作文
效果图绘制岗位职责
英语六级作文Discrimination in Education
The Illness From Air-condition英语作文
华为认证传送网HCNA-Transmission模拟试题及答案
is it necessary to question the authority英语作文
School trip on this Sunday初中英语作文
英语四级作文:Computers in Students Flats
Unit 2 I think that mooncakes are delicious说课稿范文
Monsters In The Class英语作文
JavaScript instanceof 的使用方法有哪些
CSS3制作导航条和毛玻璃效果
人物性格分析 The Analysis of Personal Character英语作文
C++中const-cast与reinterpret-cast运算符的用法
七年级Unit 4 Dn’t eat in class. Sectin A说课稿
Unit 5 It must belong to Caral section A英语评课稿
Some words for this special occasion英文美文欣赏
函数的基本性质——单调性
《Unit 12 Dont eat in class》教案
A Letter to Univsity Pesident about the Canteen Service on C
九年级《unit 6 I like music that I can dance to. Period2》评课稿
高中英语作文及翻译:My Military Training Instructor
四级作文:Create a Conservation-Oriented Campus