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 Basics (2014) The Box Model Margins

Jeremy Solomon
Jeremy Solomon
2,276 Points

CSS - later CSS being overridden by earlier CSS

In this example, a margin of 0 is applied to the body at the very top of the CSS sheet. However, we are styling .wildlife at the bottom of the sheet. All the styles I added to .wildlife, per the video, worked until I got to margin. When I preview it and pull up the console, my margin is crossed out with a yellow icon next to it that contains an explanation point. It shows that its inheriting its margin from the body element. Why will it no use the new margin? thanks.

Serge Honderdos
Serge Honderdos
8,918 Points

Can you add your workspace?

Jeremy Solomon
Jeremy Solomon
2,276 Points

Serge,

Thanks for replying. I've since gone through several workspaces and am not sure which one it is, though i can look this evening. how do i link to my workspace? or do you want me to copy/paste the code? thanks.

Serge Honderdos
Serge Honderdos
8,918 Points

I think you can simply copy the url.. not sure tough, I'm new here ;-)

Hi Jeremy,

Copy / paste the code and someone will be able to help explain what is going on. Also, when you post code, it won't benefit from syntax highlighting until you add markdown to it.

If you're curious about how to add markdown, checkout this thread on posting code to the forum . Also, there is a link at the bottom called Markdown Cheatsheet that gives a brief overview of how to add markdown to your posts.

Jeremy Solomon
Jeremy Solomon
2,276 Points

Thanks guys. I'm not sure which workspace it was and don't want to spend the next 30 minutes looking for it, but now that I know how to post code to the forum i'll include it next time. thanks again.

1 Answer

These type of problems are usually caused by specificity.

i.e a more specific rule overriding another rule.

A good guide on this is available on Andy Clarkes website:

http://www.stuffandnonsense.co.uk/archives/css_specificity_wars.html