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

1 Like

didn’t work. should I invite u?

1 Like

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

1 Like

didn’t work. sry for all this

1 Like

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!

1 Like

I’m going to try that , thanks!

2 Likes

Thanks for that! it works but I think I’ll stop with bootstrap and stick with either plain css, SCSS, or tailwind :]

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.