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

How to prevent line-height from adding a margin in the top?

Hi. How do you prevent a line-height from adding a margin at the top? I would like my paragraph to touch the top of my container.

1 Answer

This is a tricky one as often it comes down to the font used. Try using a CSS reset style sheet before adding your own custom code, I like http://meyerweb.com/eric/tools/css/reset/ .

Option two is to try setting line-height: 0em;

Option three is to set a negative margin (feels so wrong) e.g. top-margin: -4px;