gpt4 book ai didi

html - Bootstrap 和居中网页

转载 作者:搜寻专家 更新时间:2023-10-31 21:46:17 25 4
gpt4 key购买 nike

我正在尝试使用 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>

感谢任何帮助。

最佳答案

你必须删除 body 规则

body {
width: 1200px;
}

还有容器流体规则

.container-fluid {
margin: 0 auto;
}

来自您的 CSS。将类 col-sm-6 替换为 col-sm-12 并向该 div 添加类 text-center。如果你想在左右两侧使用一些排水沟,请使用类 container 而不是 container-fluid。选择是你的。但我建议您使用 container 类,因为它适合您的需要。

最后的样子:

<!DOCTYPE html>
<html>
<head>
<title>Regent</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/bootstrap.css" rel="stylesheet" />
<style>
#banner {
background-image: url(../images/2000%20x%20150_Bubble_Final_Crop.jpg);
height: 150px;
}

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;
}

</style>
</head>
<body>

<div class="container">
<section class="row">

<header id="banner">
<h1>Pixinsight Basics</h1>
</header>

<div class="col-sm-12 text-center">
<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>

关于html - Bootstrap 和居中网页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39715557/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com