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 trialAakash Srivastav
Full Stack JavaScript Techdegree Student 11,638 Pointsmargin and padding
.name a, .main-nav a{ padding: 10px 15px; } When I write this code , then the browser apply only horizontal padding of 15px . But surprisingly , when i write - .name, .main-nav li{ padding: 10px 15px; } above code , both horizontal and vertical padding got applied. I am totally confused, because Guil said vertical padding doesn't get apply on inline elements.But here- .name, .main-nav, .main-nav li{ display: inline; } He has set ".main-nav li" as inline element. Please help me.I am totally stuck.
1 Answer
Lee Cockcroft
10,278 PointsThis is because its an inline tag.
Inline tags you can only move them sideways using the margins.
If you give it a "display:block" you'll then be able to use top, bottom margins
Hope this helps