【发布时间】:2020-04-09 00:15:36
【问题描述】:
我不使用引导程序“col-”类控制“navbar-fixed-top”的宽度。到目前为止,我发现的建议建议添加到 Bootstrap CSS 或使用“容器流体”,尽管我还没有弄清楚如何在后一个选项中使用“col--”来控制宽度。 p>
基本上,我想对以下脚本进行相同的操作,但将导航栏固定在顶部。
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Case</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="col-md-2"></div>
<div class="col-md-8">
<nav class="navbar navbar-inverse">
<div class="navbar-header">
<a class="navbar-brand" href="#">WebSiteName</a>
</div>
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Page 1</a></li>
<li><a href="#">Page 2</a></li>
<li><a href="#">Page 3</a></li>
</ul>
</nav>
<p>1. A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll. A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll. A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll. A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll. A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll.</p>
<p>2. A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll. A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll. A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll. A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll. A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll.</p>
<p>3. A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll. A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll. A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll. A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll. A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll.</p>
<p>4. A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll. A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll. A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll. A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll. A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll.</p>
</div>
<div class="col-md-2"></div>
</body>
</html>
我已经使用this W3Schools page on navbar-fixed-top 来测试上面的 HTML。你有什么工作想法吗?
【问题讨论】:
标签: twitter-bootstrap navbar grid-layout