Author : MD TAREQ HASSAN | Updated : 2020/11/11
Centering a div
- div:
class="container d-flex"
- element inside div:
class="m-auto"
- Courtesy: https://stackoverflow.com/a/64780990/4802664
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.3/css/bootstrap.min.css" crossorigin="anonymous">
<div class="container d-flex mt-5" style="height:110px; background-color: #333;">
<h2 class="m-auto"><a href="https://hovermind.com/">H➲VER➾M⇡ND</a></h2>
</div>
Centering table td content
<td class="text-center">Xxx</td>
Placing a div at the center of the screen
- Css class:
min-vh-100
- Align at middle (described above)
<div class="container d-flex min-vh-100">
<div class="m-auto">
<!-- Contents go here -->
</div>
</div>