1

I'm creating a basic website in Bootstrap. The page I'm trying to create is a basic landing page with navbar at the top and then some text in a row in the main page.

I'd like to vertically and horizontally center the text so it's in the dead center of the page. I can center the text normally in the row but can't get it in the center of the page.

Is this possible with Bootstrap 3x? I know it is with Flexbox but ideally looking to build in Bootstrap.

<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewpoint" content="width=device-width" , initial-scale="1">
  <title>Sample Website</title>
  <!-- BOOTSTRAP -->
  <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
  <!-- MY CUSTOM CSS -->
  <link rel="stylesheet" type="text/css" href="css/mycss.css">
</head>

<body>
  <nav class="navbar navbar-default">
    <div class="container">
      <div class="navbar-header">
        <a class="navbar-brand" href="index.html">Sample Brand</a>
      </div>
      <ul class="nav navbar-nav navbar-right">
        <li><a href="index.html">Home</a></li>
        <li><a href="page1.html">Page 2</a></li>
        <li><a href="page2.html">Page 3</a></li>
        <li><a href="page3.html">Page 4</a></li>
        <li><a href="page4.html">Page 5</a></li>
      </ul>
    </div>
  </nav>

  <div class="container">
    <div class="row">
      <div class="col-sm-1">
        <p> I want to vertically and horizontally align this text so it's in the middle of the page</p>
      </div>

    </div>
  </div>
  <!-- jQuery CDN -->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <!-- BOOTSTAP JS FILE -->
  <script src="js/bootstrap.min.js"></script>
</body>

</html>
ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Philpot
  • 216
  • 5
  • 17
  • Are you planning to just have one row of text in the center, or could it be more? Static text or dynamic? – freginold Aug 23 '17 at 12:28
  • It would be a photo with text underneath. I'm using Bootstrap 3 and just played around with Bootstrap 4 which supports Flexbox. This seems to be a much easier solution. – Philpot Aug 23 '17 at 14:33

0 Answers0