1

我不知道我在这里做错了什么。我正在尝试将引导程序自定义样式的导航栏放在顶部,但要在移动设备上做出响应。

如您所见,这不会发生。让你的窗口低于 940 像素。

它在我的移动设备上完全搞砸了。我确定我在这里遗漏了一些非常基本的东西。这是我的 HTML:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Social Website</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="./css/bootstrap-responsive.css" rel="stylesheet">
<link href="./css/bootstrap.css" rel="stylesheet">
<link href="./css/main.css" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800' rel='stylesheet' type='text/css'>
<style>
body {
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
}
</style>

<!-- Fav and touch icons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">
<link rel="shortcut icon" href="../assets/ico/favicon.png">
</head>

<body>

<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="#">Social Website</a>
<div class="nav-collapse collapse">
<ul class="nav">
<div class="spacer"></div>
<li><a href="#">Uploads</a></li>
<div class="spacer"></div>
<li><a href="#about">Categories</a></li>
<div class="spacer"></div>
<li><a href="#contact">Random</a></li>
<div class="spacer"></div>
</ul>
<ul class="nav pull-right">
<div class="spacer"></div>
<li><a href="#">My Account</a></li>
<div class="spacer"></div>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
</div>

<div class="container">

<h1>Under Construction</h1>
<p>This website is currently under construction, come back later or something.</p>

</div> <!-- /container -->

<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>
<script src="./js/bootstrap.min.js"></script>

</body>
</html>
4

1 回答 1

2

包括 <link href="./css/bootstrap-responsive.css" rel="stylesheet">after<link href="./css/bootstrap.css" rel="stylesheet">并指定一个widthfor .container在http://twitter.github.io/bootstrap/examples/fluid.html上有一个流体布局的例子

于 2013-04-26T15:24:30.463 回答