Bootstrap and web page centering

I am trying to create a simple webpage in Dreamweaver CC using Bootstrap. I cannot figure out how to make the displayed web page centered in the browser. The page just remains valid. Here is the code I'm trying to use:

HTML5 and 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 JavaScript plugins) --> 
    <script src="js/jquery-1.11.2.min.js"></script>


    <script src="js/bootstrap.js"></script>
    </section>
    </div> <!--container-fluid-->

    </body>
</html>
Run codeHide result

Appreciate any help.

+4
source share
2 answers

To fix this, remove the body width and add the width to the container fluid, the result will be css:

#banner {
  background-image: url(../images/2000%20x%20150_Bubble_Final_Crop.jpg);
  height: 150px;
}
body {
  margin:0;
  padding:0;
}
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;
  width: 1200px;
}
<!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 JavaScript plugins) --> 
    <script src="js/jquery-1.11.2.min.js"></script>


    <script src="js/bootstrap.js"></script>
    </section>
    </div> <!--container-fluid-->

    </body>
</html>
Run codeHide result
0
source

You need to remove the body rule

body {
    width: 1200px;
}

as well as the rule of container fluid

.container-fluid {
    margin: 0 auto;
}

CSS. col-sm-6 col-sm-12, text-center div. , - 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 JavaScript plugins) --> 
    <script src="js/jquery-1.11.2.min.js"></script>


    <script src="js/bootstrap.js"></script>
    </section>
    </div> <!--container-fluid-->

</body>
</html>
0

Source: https://habr.com/ru/post/1655909/


All Articles