【发布时间】:2017-02-04 13:09:09
【问题描述】:
我正在尝试使用 Bootstrap 在 Dreamweaver CC 中创建一个简单的网页。我无法弄清楚如何使显示的网页在浏览器中居中。该页面保持左对齐。这是我尝试使用的代码:
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-fluid 获取设备的全宽。如果您没有定义宽度并且还需要使用全宽,请不要为 .container-fluid 类定义样式。另一件事是,如果您不需要使用流体宽度并且专注于固定宽度,请使用 .container 类,其默认宽度为 1170px,如果需要,您可以覆盖它。
标签: html css twitter-bootstrap dreamweaver