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

Brian Patterson
Brian Patterson
19,588 Points

My group buttons won't center.

My group buttons won't center. What is the correct code, please?

<div class="btn-group text-center mt-2" role="group" aria-label="Basic example">
                    <button type="button" class="btn btn-primary btn-lg">Register Now</button>
                    <a class="btn btn-secondary btn-lg" href="#speakers">See Speakers</a>
                </div>

1 Answer

Tresean Adam
Tresean Adam
6,216 Points

Hey Brian,

I can't remember exactly which class it was but, here is what I have for that section. Hopefully it helps.

<div class="btn-group mt-3" role="group"> 
      <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#register">Register Now</button>
      <a class="btn btn-secondary btn-lg" href="#speakers">See Speakers</a>

       </div>
Brian Patterson
Brian Patterson
19,588 Points

Tresean, This seemed to work as well

<div class="wrapper text-center">
          <div class="btn-group text-center mt-2" role="group" aria-label="Basic example">
                    <button type="button" class="btn btn-primary btn-lg">Register Now</button>
                    <a class="btn btn-secondary btn-lg" href="#speakers">See Speakers</a>
                </div>
      </div>