Centering block in Bootstrap

Question:

How can I center the block in bootstrap?


Repl link:
Repl Link

In bootstrap 4 (and Im assuming in the most recent version as well) you can use this class. class="d-flex justify-content-center".

From this answer

didn’t work. should I invite u?

No since I dont know bootstrap my self. Mabey try this

<div class="row">
    <div class="col-4 d-flex justify-content-center">
        // Image
    </div>
</div>

From This answer

didn’t work. sry for all this

Does this work?

<div class="row">
    <div class="col-md-8 offset-md-2">
      <h3>Look! I am Centered Horizontally</h3>
    </div>
  </div>

Just change the text for what ever you want to center!

I’m going to try that , thanks!

1 Like