I thought this would work but it doesn’t.
What I am doing wrong?
html, body {
min-height: 100vh;
}
header, footer {
background-color: blue;
height:100px
}
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<html>
<body>
<header></header>
<section class="container bg-danger h-100">
<div class="row h-100">
<div class="col-12 py-5 my-5 h-100">
<ul class="main_menu list-unstyled">
<li class="rounded mb-2 py-2"><a href="/">foo</a></li>
<li class="rounded mb-2 py-2"><a href="/">bar</a></li>
<li class="rounded mb-2 py-2"><a href="/">baz</a></li>
</ul>
</div>
</div>
</section>
<footer></footer>
</body>
</html>
It looks like your post is mostly code; please add some more details.
2
Answers
Everything seems perfect! you just need to give the height of html/body a dynamic height as you are giving header and footer height of 100px which is equal to 200px so minus this height from the overall height. Example below:
You need to write your css like this.