Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,135 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