仿写Bootstrap中的响应式导航条

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
         .navbar{
             height:50px;
             background: #e0e0e0;
         }
        .navbar-brand{
            font-size: 1.5em;
            font-weight: bold;
            line-height: 50px;
        }
        a{
            color:#000;
            text-decoration: none;
        }
        .navbar-toggle{
            float:right;
            line-height:50px;
            border:1px solid #aaa;
            padding:8px;
        }
        .navbar-collapse{
            background: #fff;
            margin: 0;
            display: none;
        }
        .icon-bar{
            display: block;/*将行内块元素span表现成块级元素,使允许修改其尺寸*/
            width: 22px;
            height: 2px;
            background: #888;
            border-radius: 1px;
            box-sizing: border-box;
            margin:5px 0px;
        }
    </style>
</head>
<body>
<h1>仿写Bootstrap中的响应式导航条</h1>
<div class="navbar">
    <div class="navbar-header">
        <a class="navbar-brand" href="#">TARENA</a>
        <a class="navbar-toggle" href="#">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </a>
    </div>
    <div class="navbar-collapse">
        <ul class="navbar-nav">
            <li><a href="#">组件</a></li>
            <li><a href="#">插件</a></li>
            <li><a href="#">JS</a></li>
            <li><a href="#">HTML</a></li>
            <li><a href="#">CSS</a></li>
        </ul>

    </div>
</div>
<script src="js/jquery-1.11.3.js"></script>
<script>
    $('.navbar-toggle').click(function(e){
        e.preventDefault();
        $(this).parent().siblings('.navbar-collapse').slideToggle(300);
    });
</script>
</body>
</html>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值