简单菜单不在新行开始 -- BootStrap
Simple Menu not starting on new line -- BootStrap
我正在努力学习 bootstrap 并且对基础知识感到非常困惑
我有这个菜单。当它处于移动模式时,会出现三个堆栈栏,但菜单从 header 行开始。期望的结果是从 header 下面的行开始。我错过了什么 class 或我做对了什么
感谢您的帮助。
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap 3</title>
<meta name="viewport" content="width=device=width, initial-scale=1.0">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="navbar navbar-inverse navbar-static-top">
<div class="container">
<a href="#" class="navbar-brand">Mike's Site</a>
<button class="navbar-toggle" data-toggle="collapse" data-target=".navHeaderCollapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- do we need collapse and navbar-collapse-->
<div class="collapse navbar-collapse navHeaderCollapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Home</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Social Media</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="js/bootstrap.js"></script>
</body>
</html>
试试这个,我已经为右侧的导航栏添加了一个 ul 定义。更改了调用数据目标的方式(仍然是新的,所以不知道是否需要)
<div class="navbar navbar=default navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a href="#" class="navbar-brand">Mike's Site</a>
<button type="button" class="navbar-toggle collaspe" data-toggle="collapse" data-target="#navHeaderCollapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!--do we need collapse and navbar-collapse-->
<div class="collapse navbar-collapse" id="navHeaderCollapse">
<ul class="nav navbar-nav">
<li><a href="#">Home</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Social Media</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Home</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Social Media</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
我正在努力学习 bootstrap 并且对基础知识感到非常困惑 我有这个菜单。当它处于移动模式时,会出现三个堆栈栏,但菜单从 header 行开始。期望的结果是从 header 下面的行开始。我错过了什么 class 或我做对了什么
感谢您的帮助。
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap 3</title>
<meta name="viewport" content="width=device=width, initial-scale=1.0">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="navbar navbar-inverse navbar-static-top">
<div class="container">
<a href="#" class="navbar-brand">Mike's Site</a>
<button class="navbar-toggle" data-toggle="collapse" data-target=".navHeaderCollapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- do we need collapse and navbar-collapse-->
<div class="collapse navbar-collapse navHeaderCollapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Home</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Social Media</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="js/bootstrap.js"></script>
</body>
</html>
试试这个,我已经为右侧的导航栏添加了一个 ul 定义。更改了调用数据目标的方式(仍然是新的,所以不知道是否需要)
<div class="navbar navbar=default navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a href="#" class="navbar-brand">Mike's Site</a>
<button type="button" class="navbar-toggle collaspe" data-toggle="collapse" data-target="#navHeaderCollapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!--do we need collapse and navbar-collapse-->
<div class="collapse navbar-collapse" id="navHeaderCollapse">
<ul class="nav navbar-nav">
<li><a href="#">Home</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Social Media</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Home</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Social Media</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>