Web实训知识点——3.19

1.导航栏(变换菜单,多级菜单)
复习JavaScript html以及CSS
代码实现:
方法一:div方法的实现
完整代码:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<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>
</head>

<body>
<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>
</body>
<html>

方法二:用ul li方法实现

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<style type="text/css">
a{
    color: #ffff99;
    text-decoration: none;
}
a:hover{
    color: #ffffff;
    text-decoration: underline;
}
.top-nav{
padding: 10px 10px 0;
font-size: 12px;
font-weight: bold;
margin: 1px 0 0 0;
list-style: none;
border-bottom: 8px solid #dc4e18;
overflow: hidden;
background-color:#335166;
}
.top-nav li{
float: left;
margin-right: 1px;
}
.top-nav li a{
position: relative;
z-index: 0;
line-height: 20px;
text-decoration: none;
background: #cc0000;
color: #666666;
display: block;
width: 80px;
text-align: center;
}
.top-nav li a span{
position: absolute;
visibility: hidden;
}

.top-nav li a:hover span{
        line-height: 20px;
        text-decoration: none;
        background: #dddddd;
        color: #666666;
        display: block;
        width: 80px;
        text-align: center;
        padding-top: 2px;
        visibility: visible;
        top: 0;
        left: 0;
        color: #ffffff;
        background: #dc4e18;
        }

 </style>

<body>
<div  id="top">
<ul class="top-nav">
<li><a href="#">首页<span>Home</span></a><>
<li ><a href="#">大厅<span>Course</span></a><>
<li ><a href="#">学习中心<span>Learn</span></a><>
<li ><a href="#">关于我们<span>About</span></a><>
</ul>
</div>
</body>
<html>

2.JQuery基础------js框架,简单易用,代码量少。
js10行。JQuery2行就可以搞定

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值