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 trialLucan Greg
484 PointsHow we lost -4px margin?
why we lost 4 px of negative margin? Did we overwrite value -4px, because first value and later on we add the same property with a margin 4% its last in the document so it will take values from there instead of the first column we targeted?
1 Answer
Steven Parker
231,261 PointsYou're right that the cascade rules say a later setting will override a previous one, but in this case there's a more important rule involved. That other rule says that something selected with a higher specificity will override anything with a lower specificity regardless of order.
Adding the "first-child" pseudo to the selector gives it a higher specificity than the more generic selector.