1

I've downloaded bootstrap 4.3.1 and for the life of me I can't get vertical alignment to work under any circumstance if I have a <!DOCTYPE html> tag at the head of the html.

EDIT: With the body tag, results are the same.

<!DOCTYPE HTML>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="stylesheets/bootstrap.min.css" type="text/css">
</head>

<body>
<div class="container">
    <div class="row h-100 justify-content-center align-items-center">
    <div class="mx-auto col-sm-6" style="border: 2px solid red">
        <h3 class="text-center">Heading3</h3>
        <h4 class="text-center">Heading4</h4>
    </div>
    </div>
</div>
</body>
</html>

This divs are still stuck to the top of the screen unless I comment out the doctype. I have tried adding a custom css with body{height:100%} and body{min-height:100%} and no matter what, the doctype breaks vertical alignment. This happens in both Chrome and Safari. Any ideas?

iceblueorbitz
  • 920
  • 1
  • 7
  • 17

0 Answers0