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

Margin doesnt wokr.

HI, So i have a problem with my maring.

I set header etc.. nd they all got margin 100px 0 . They work, nd the space is 200px between but now, on my about page, the margin is like not there , why ? : pit merges with the top margin .

could you include the code?

1 Answer

The margin property can have from one to four values. Perhaps you were trying to control the top margin separately? See examples below:

margin: 25px 50px 75px 100px; top margin is 25px right margin is 50px bottom margin is 75px left margin is 100px

margin: 25px 50px 75px; top margin is 25px right and left margins are 50px bottom margin is 75px

margin: 25px 50px; top and bottom margins are 25px right and left margins are 50px

margin: 25px; all four margins are 25px

Yes, i know that, thank you : ) but what i mean is that i have to divs right? that apply the same margin on each other , it merges nd i dont know why. I figured it out now for the effect i wanted , i had to put padding to expand the background etc.. but im still curious why the margin did merge .