我想在Dreamweaver CC中使用Bootstrap製作一個簡單的網頁。我無法弄清楚如何使顯示的網頁在瀏覽器中居中。該頁面保持左對齊。這裏是我嘗試使用代碼:Bootstrap和居中網頁
HTML5 & CSS
#banner {
background-image: url(../images/2000%20x%20150_Bubble_Final_Crop.jpg);
height: 150px;
}
body {
width: 1200px;
}
h1 {
color: #FFFFFF;
padding-top: 25px;
font-family: Cambria, "Hoefler Text", "Liberation Serif",
Times, "Times New Roman", serif;
font-size: 58pt;
text-shadow: 2px 2px 24px #D7DC23;
text-align: center;
}
.container-fluid {
margin: 0 auto;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Pixinsight Basics</title>
<!-- Bootstrap -->
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="container-fluid">
<section class="row">
<header id="banner">
<h1>Pixinsight Basics</h1>
</header>
<div class="col-sm-6">
<h3>Heading 3</h3>
<p>Hello my fellow astronomers. I have chosen to use Pixinsight
as my primary processing software. Like you (probably) I have sifted
around the internet looking for information/tutorials on how to use
Pixinsight. While this is by no means a comprehensive data set on
how to use Pixinsight, it should at least get you up and running.
I have divided this information into 3 distinct processing areas of
interest:</p>
<ul>
<li>
<!--[if !supportLists]--><!--[endif]-->
Calibration</li>
<li>
<!--[if !supportLists]--><!--[endif]-->
Linear</li>
<li>
Non–Linear</li>
</ul>
<p>Just click on one of the buttons below and it will
take you to your area of interest.</p>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="js/jquery-1.11.2.min.js"></script>
<script src="js/bootstrap.js"></script>
</section>
</div> <!--container-fluid-->
</body>
</html>
得到任何幫助。
.container流體獲得該裝置的整個寬度。如果您沒有定義寬度,並且還需要使用全寬度,則不要爲.container-fluid類定義樣式。其他的事情是,如果你不需要使用流體寬度,並且你關注的是固定寬度,那麼使用.container類,它的默認寬度是1170px,如果需要,你可以覆蓋它。 – user2584538