1.利用JQuery---->JS框架(特点:简单易用,代码量少)
JQuery2行等于JS10行(简便)
JS注释方式:单行注释:// 多行注释:/* */
导航栏实现:
代码及导航条
html部分:
ul类型
<ul class="nav">
<li><a href="#">首 页</a><>
<li><a href="#">关于我们</a><>
<li><a href="#">产品展示</a><>
<li><a href="#">售后服务</a><>
<li><a href="#">联系我们</a><>
</ul>
css部分:
*{ margin:0; padding:0; font-size:14px; }
ul{ list-style:none; width:100px; }
li{ height:30px; line-height:30px; width:100px; background-color:#f60; margin-bottom:1px; padding-left:10px;}
a{text-decoration:none; display:block; height:30px; line-height:30px; width:100px; background-color:#f60; margin-bottom:1px; padding-left:10px;}
a:hover{ background-color:#f60; color:#0000;}
div类型
html部分:
<div id="top">
<div class="top-nav"><a href="123">首页<span class="span">Home</span></a></div>
<div class="top-nav"><a href="123">课堂大厅<span class="span">Course</span></a></div>
<div class="top-nav"><a href="123">学习中心<span class="span">Learn</span></a></div>
<div class="top-nav"><a href="123">关于我们<span class="span">About</span></a></div>
</div>
css部分:
<style type="text/css">
a{
color: #FFFF99;
text-decoration: none;
}
a:hover{
color: #FFFFFF;
text-decoration: underline;
}
#top{
padding: 10px 10px 0;
font-size: 12px;
font-weight: bold;
margin: 1px 0 0;
list-style: none;
border-bottom: 8px solid #DCE6F4;
overflow: hidden;
background-color: #33b5e5;
}
.top-nav{
float: left;
margin-right: 1px;
background-color: #333333;
position: relative;
width: 80px;
height: 20px;
text-align: center;
line-height: 20px;
}
.top-nav span{
position: absolute;
visibility: hidden;
}
.top-nav:hover span{
line-height: 20px;
background: #DDDDDD;
color: #666666;
display: block;
width: 80px;
text-align: center;
padding-top: 2px;
visibility: visible;
top:0;
left: 0;
color:#FFFFFF;
background:#DC4E1B;
}
</style>