HomeОбразованиеRelated VideosMore From: Mostafa Elgayar

How to Center a Div in Bootstrap

181 ratings | 37691 views
In this video, you'll be introduced to an equation that'll change your life. If you have any questions, please leave it in the comments below! Don't forget to like and subscribe! Follow me on: Facebook: http://fb.com/mostafa.elgayar1 Twitter: http://twitter.com/MostafaaGayar Good Luck! :)
Html code for embedding videos on your blog
Text Comments (24)
Akil Bukhari (5 days ago)
My Magic Tricks is Class="justify-content-center" or class="mx-auto" it's works for all odd even column :)
aqeel bukhari (2 months ago)
Not need any formula. just add .justify-content-center with .row class.
Samuel Caine (5 months ago)
how to center vertically?
Juan Pablo Ortiz (5 months ago)
more thank 25k views.... for just one simple question. That's why I hate bootstrap.
Fatimaezzahra Rarhibou (5 months ago)
Finally someone with a simple straight-forward answer that actually works !! Thank youu
Imre Maczkó (5 months ago)
"Dont belive the hype"
Cletus Ajibade (6 months ago)
James Jackson (10 months ago)
For BOOSTRAP 4... instead of ( col-lg-offset-4 ) you need to use ( offset-lg-4 ) without the brackets of course :-)
Adam Wisniewski (10 months ago)
Thanks! Nice vid
la turkmusun amın evladi
JAYA Innovation (1 year ago)
thank you brother
mouthymerc (1 year ago)
Centering an odd number of divs is exactly my problem though...
rpuls (1 year ago)
For those who are using bootstrap v4, this wont work. Instead use class="mx-auto" which works for all col sizes. In short is set margin left and right to auto, which centers your div.
ali sali (1 month ago)
+Adam Wisniewski hahaha for me it takes 5 hour, sometimes simple things gonna be big deal
Rick Vaarkamp (6 months ago)
Thanks :-)
jiilaal (8 months ago)
thanks it works
Emmanuel Vinicius (9 months ago)
love ya
Adam Wisniewski (10 months ago)
I wish I saw this comment 4 hours ago....wouldnt have had to bash my head in wondering why what i was trying to do wasnt working all those times
Fouadd Chelfii (1 year ago)
Thanks you!
nizamm (1 year ago)
dude.........YOU. ROCK. THANK. YOU.
Halwest Star (1 year ago)
Been searching the whole day till I watched your video!
Adam Kamali (1 year ago)
With the move to flexbox in Bootstrap v4. this no longer works, try use margin utilities like .mr-auto to force sibling columns away from one another. Check Bootstrap v4 docs for details and examples
Lucas Veldmaat (1 year ago)
I was searching a while for this answer >< thanks!
Ernest Alferez (1 year ago)
Thanks to you!

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.