centre div bootstrap 4 code example

Example 1: centralize div bootstrap

<div class="row align-items-center justify-content-center">
    <div class="col">This will be centered vertically and horizontally</div>
</div>

Example 2: center vertically and horizontally bootstrap 4

<div class="container h-100">
  <div class="row h-100 justify-content-center align-items-center">
    <form class="col-12">
      <div class="form-group">
        <label for="formGroupExampleInput">Example label</label>
        <input type="text" class="form-control" id="formGroupExampleInput" placeholder="Example input">
      </div>
      <div class="form-group">
        <label for="formGroupExampleInput2">Another label</label>
        <input type="text" class="form-control" id="formGroupExampleInput2" placeholder="Another input">
      </div>
    </form>   
  </div>
</div>

Tags:

Html Example