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 CSS Selectors Selectors - Beyond the Basics DRY CSS

I want to center the buttons

I would like to center the buttons for SUBMIT and RESET. How can I do it? Guil in the video for DRY he did this @media (min-width: 769px) { .inln { width: auto; display: inline-block; } } but I would like to center them. I need help.

3 Answers

Bogdan Cabaj
Bogdan Cabaj
16,348 Points

Hi Oscar,

In order to center both buttons you will have to wrap both buttons in a div.

.center {
 text-align: center;

I gave my div a class of center and added center class selector to my css.

      <div class="center">
        <input class="btn default inln" type="submit" value="Submit">
        <input class="btn inln error" type="reset" value="Reset"> 

I hope this is what you wanted.

text-align: center;

Thanks Bogdan it worked.