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 Child, Adjacent, and General Sibling Combinators

deepak sharma
deepak sharma
3,844 Points

why dont be use margin-right in adjacent selector in .btn + .btn.. and why is it not working

.btn + .btn { margin-right: 20px; }

2 Answers

The btn + btn wouldn't tag the first button but in this case the one right next to it. (or any following the first button if more than 2). If you would use a margin-right it would leave both buttons very close to each other and then with the 3rd there would be the 20px gap.

Also could you please post your code so we could help?

I made the mistake of not putting this code in the original media query from earlier.
It should look like the following:

@media (min-width: 769px) { .inln { width: auto; display: inline-block; } .btn + .btn { margin-left: 20px; } }

Hi deepak,

To get some separation between the submit and reset buttons, you could either apply a right margin to the submit button or a left margin to the reset button.

Guil is using the selector .btn + .btn This will target any button that follows another button.

In this case, the reset button follows the submit button and so that selector will target the reset button.

Because you're targeting the reset button you would want to apply a left margin.