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
Joe Consterdine
13,965 PointsWhy Can You Give Links Padding/Margin?
Hey guys,
I think I'm going insane.
You can give links padding/margin... but they're inline no?
I thought you couldn't give padding, margin, border, widths or heights to inline elements?
Is links an exception or something?
Cheers
3 Answers
Cheryl Oliver
21,676 PointsLinks are inline elements. You can only add left and right margin or padding, not top or bottom. Which is the same as all inline elements. To add any other margins or padding you would have to change them to inline-block.
Joe Consterdine
13,965 PointsHere's a codepen with a link with padding and margin all the way around?
http://codepen.io/anon/pen/XXQpNX
It's inline aswell.
Cheers.
Cheryl Oliver
21,676 PointsNo problem. I'm still learning too but just watched a section on this :)
Joe Consterdine
13,965 PointsI think padding doesn't work for top and bottom but what it does is fill the line-height.