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

How to Center a Div in Bootstrap

162 ratings | 33610 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 (22)
aqeel bukhari (4 days ago)
Not need any formula. just add .justify-content-center with .row class.
Samuel Caine (2 months ago)
how to center vertically?
Juan Pablo Ortiz (3 months ago)
more thank 25k views.... for just one simple question. That's why I hate bootstrap.
Fatimaezzahra Rarhibou (3 months ago)
Finally someone with a simple straight-forward answer that actually works !! Thank youu
Imre Maczkó (3 months ago)
"Dont belive the hype"
Cletus Ajibade (4 months ago)
Good.
James Jackson (7 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 (8 months ago)
Thanks! Nice vid
THY Türk Hava Yolları (10 months ago)
la turkmusun amın evladi
JAYA Innovation (10 months ago)
thank you brother
mouthymerc (11 months ago)
Centering an odd number of divs is exactly my problem though...
rpuls (11 months 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.
Rick Vaarkamp (4 months ago)
Thanks :-)
jiilaal (6 months ago)
thanks it works
Emmanuel Vinicius (7 months ago)
love ya
Adam Wisniewski (8 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.