我不知道我在這裏做錯了什麼。我試圖讓自定義風格的導航欄坐在頂部,但在移動設備上可以快速響應。Twitter Bootstrap - 響應式導航欄
正如你所看到的,這不會發生。讓你的窗口去940px下面看看這個:
這完全打亂了我的移動設備上。我相信我在這裏錯過了一些非常基本的東西。這是我的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="description" content="A social website by Inferno Web Media, LTD.">
<meta name="author" content="Tom Wilson of Inferno Web Media, LTD.">
<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>
bootstrap-responsive.css文件應該在bootstrap.css文件後加載。 – 2013-04-26 15:26:35
謝謝,修正了它! – 2013-04-26 15:33:38
如果您正在編寫響應式設計,請使用「容器流體」而不是「容器」。 – cortex 2013-04-26 15:36:41