Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialShunsuke Taguchi
9,380 PointsHow center a button
I tried to center a button but it didn't work. Did I miss anything?
<button type="button" class="btn btn-outline-info btn-lg center-block m-y-3">Don't miss out! Register Now</button>
Ryan Oakes
9,787 PointsI was experiencing the same thing! I investigated and apparently .center-block was removed in favor of .m-x-auto.
I'd follow Jorge's example down below!
Mister Moody
48,333 PointsSame question was asked elsewhere~ Add the class of "d-block" & "m-x-auto" to correct the issue!
1 Answer
Jorge Soto
5,379 PointsHi, I managed to do it like this.
<button type="button" class="btn btn-outline-info d-block m-x-auto">
Don't Miss Out Register Now
</button>
"d-block" changes the display property to "block" and well, Guil already explained m-x-???, I just added "auto" and it worked.
I guess Bootstrap has changed something in our version.
Obaa Cobby
9,337 PointsJust for future learners, use "mx-auto" //new syntax with Bootstrap-4.
Erik Nuber
20,629 PointsErik Nuber
20,629 Pointsjust a note, won't fix the issue but it should be btn-info-outline you have it reversed.
I've looked at your code closely and it matches exact otherwise to the code in the video.