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 trial

CSS Bootstrap 4 Basics (Retired) Using Bootstrap Components Adding Buttons and Button Groups

Daniel Schroeder
Daniel Schroeder
13,859 Points

Call-to-action button doesn't center with .center-block, not finding this class in Bootstrap 4 docs either!

Using the latest Bootstrap CDN (<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.4/css/bootstrap.min.css" integrity="2hfp1SzUoho7/TsGGGDaFdsuuDL0LX2hnUp6VkX3CUQ2K4K+xjboZdsXyp4oUHZj" crossorigin="anonymous">) and trying to follow along with Guil and center the "call-to-action" <button> with .center-block, but this is not working. I can't find it in the docs either, and m-x-auto (which looks like it would be the alternative) doesn't seem to work to center the <button> element. Is there another way to center the "call-to-action" button on the page using Bootsrap4?

1 Answer

Daniel Schroeder
Daniel Schroeder
13,859 Points

I should've checked the questions first! Someone already asked and received a satisfactory answer, my bad!

<button type="button" class="btn btn-outline-info btn-lg d-block m-x-auto">Don't Miss Out, Register Now</button>