I have gone through multiple Stack Overflow questions regarding the same topic, however I am simply not able to get this to work. I have almost tried all the solutions mentioned on below questions and none seemed to work for me.
Vertical Align Center in Bootstrap 4
Bootstrap 4 Center Vertical and Horizontal Alignment
This is how my code looks
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<title>Document</title>
<style>
body {
height: 100%;
}
.col {
border: 1px solid red;
}
.row {
height: 200px;
border: 1px solid blue;
}
</style>
</head>
<body>
<div class="container h-100 align-items-center">
<div class="jumbotron my-auto">
<div class="row">
<div class="col align-self-end">
col1
</div>
<div class="col align-self-start">
col2
</div>
</div>
<div class="row align-items-center">
<div class="col">
col1
</div>
<div class="col">
col2
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
</body>
</html>
What am I missing here?
Attached is a screenshot of my how page looks.
I know I can position the div in the center of the page using position
property but I am curious to know if it can be done with just Bootstrap without adding any custom CSS.