基于bootstrap实现收缩导航条
作者:sinat_35803474 时间:2024-04-28 09:53:16
本文实例为大家分享了bootstrap实现收缩导航条的具体代码,供大家参考,具体内容如下
效果图
贴上我的代码
<!DocType html>
<html>
<head>
<meta charset="utf-8">
<!--设置浏览器优先使用什么模式来渲染页面-->
<!--告诉IE浏览器,IE8/9及以后的版本都会以最高版本IE来渲染页面。 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=divice-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<!-- width:viewport的宽度
width=divice-width:viewport的宽度
initial-scale:初始的缩放比例
maxmum-scale:允许用户缩放的最大比例
user-scalable:是否允许用户手动缩放
--->
<link href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css" rel="external nofollow" rel="stylesheet">
</head>
<body>
<ul class="navbar navbar-default navbar-fixed-top">
<!--navbar表示导航条
navbar-defaule默认导航条样式
navbar-fixed-top导航固定在顶部-->
<div class="container-fluid">
<!--导航头部-->
<div class="navbar-header">
<a href="index.html" rel="external nofollow" class="navbar-brand">
<span class="glyphicon glyphicon-home">
</span>
<!--导航折叠按钮-->
<button class="navbar-toggle" data-toggle="collspan" data-target="#divNav">
<!--- navbar-toggle:【触发】按钮,会有下拉导航 data-toggle:交替执行某动作,collapse:展开和收缩
data-target:目标对象(自己定义一个名字-->
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<!--按钮里的内容,三条横杠-->
</button>
<!--点击按钮将显示的导航栏目-->
<div id="divNav" class="collapse nav-collapse">
<!--这里的div的id要和上面的data-target值一致,nav-collapse就是折叠导航--->
<ul class="nav navbar-nav">
<li>首页</li>
<li>菜单1</li>
<li>菜单2</li>
<li>菜单3</li>
</ul>
</div>
</div>
</div>
</ul>
</body>
</html>
这就完成了。
标签:bootstrap,导航条
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
sql脚本查询数据库表,数据,结构,约束等操作的方法
2024-01-19 17:23:26
TensorFLow 变量命名空间实例
2021-06-09 04:40:14
Python3 文章标题关键字提取的例子
2022-02-08 03:45:32
![](https://img.aspxhome.com/file/2023/4/109644_0s.jpg)
vue3 自定义指令控制按钮权限的操作代码
2024-05-09 15:08:59
![](https://img.aspxhome.com/file/2023/7/126617_0s.png)
Navicat连接MySQL错误描述分析
2024-01-17 13:39:31
![](https://img.aspxhome.com/file/2023/2/80142_0s.jpg)
Java与Mysql锁相关知识总结
2024-01-17 14:24:19
MySQL中datetime和timestamp的区别及使用详解
2024-01-19 05:58:28
用python打印菱形的实操方法和代码
2023-03-18 19:17:18
Tensorflow 实现分批量读取数据
2023-09-23 23:04:44
使用Gomock进行单元测试的方法示例
2024-04-25 15:13:23
![](https://img.aspxhome.com/file/2023/2/134152_0s.jpg)
mysql 5.7.14 下载安装、配置与使用详细教程
2024-01-15 14:39:25
MySQL在右表数据不唯一的情况下使用left join的方法
2024-01-18 22:42:02
![](https://img.aspxhome.com/file/2023/0/114020_0s.png)
Python装饰器使用示例及实际应用例子
2022-01-16 01:59:32
![](https://img.aspxhome.com/file/2023/1/82831_0s.png)
在Python程序中操作文件之isatty()方法的使用教程
2022-01-24 18:11:44
python判断列表为空的三种方法总结
2022-09-28 21:46:46
xmind2022下载非试用超详细图文教程
2023-06-03 18:52:06
![](https://img.aspxhome.com/file/2023/3/131963_0s.png)
教你如何用python操作摄像头以及对视频流的处理
2021-03-01 05:59:55
![](https://img.aspxhome.com/file/2023/9/103709_0s.jpg)
在Python中编写数据库模块的教程
2024-01-22 21:28:40
浅谈LogMiner的使用方法
2009-02-28 11:12:00
python opencv实现图片缺陷检测(讲解直方图以及相关系数对比法)
2021-02-03 19:41:24
![](https://img.aspxhome.com/file/2023/5/69475_0s.jpg)