请用bootstrap写一个简单的dashboard,要求导航栏在左边,包含三个标签,点击后分别输出1,、2、3,
时间: 2023-05-14 08:04:58 浏览: 145
解决bootstrap导航栏navbar在IE8上存在缺陷的方法
好的,以下是使用 Bootstrap 编写的简单 dashboard 代码,包含导航栏和三个标签,点击标签后分别输出 1、2、3:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Dashboard</title>
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.3/css/bootstrap.min.css">
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-2">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">Dashboard</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav flex-column">
<li class="nav-item">
<a class="nav-link" href="#" onclick="alert('1')">标签1</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#" onclick="alert('2')">标签2</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#" onclick="alert('3')">标签3</a>
</li>
</ul>
</div>
</nav>
</div>
<div class="col-md-10">
<h1>欢迎使用 Dashboard</h1>
</div>
</div>
</div>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.3/js/bootstrap.min.js"></script>
</body>
</html>
```
希望这个代码能够满足您的需求。
阅读全文