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

Chris Mitchell
Chris Mitchell
12,719 Points

bakin tutorial confusion

In a div with id= intro I have a seperate class= btn inside the div

Intro has margin 50,0,75,0; btn has margin 40px 0;

now i was playing around with the margins and it seems that the BTN class margin has no effect at all.... I even set the class BTN margin to 4000px 0; and it changed nothing.

So why is it here???

3 Answers

James Barnett
James Barnett
39,199 Points

The .btn class is applied to an a element which by default is inline as such it doesn't have top & bottom margin or padding.

There is however a simple solution use display: inline-block with the .btn class.

Kevin Korte
Kevin Korte
28,148 Points

what is your position attribute in the css set at?

I'm a visual guy so here is a cheesy codepen. Play around with the margin's and the position attribute.

If you CSS values for margins have comma's in them, that could be one problem.

http://codepen.io/anon/pen/mtwAp

Chris Mitchell
Chris Mitchell
12,719 Points

Have to give credit to both answers, @kevin, thanks for the tip on using codepen, great fun playing around with it.

@James Barnett
Worked perfect thanks. I can also get it to work with position absolute but that means the .btn can break out of the #intro div...correct???

James Barnett
James Barnett
39,199 Points

I can also get it to work with position absolute but that means the .btn can break out of the #intro div

Yep