Whitespace Above Text In a DIV With No Padding

Posted on 2011-10-24
Medium Priority
Last Modified: 2012-05-12
Hello Experts -
A quick 500 points for someone..  Using the following DIV and assuming no further CSS specified elsewhere, why is there whitespace between the top of the text and the top border?
<div style="border:1px solid black; height:30px; width:100px; padding:0; vertical-align:top;">Fubar</div>

Open in new window

The left edge of the text sits immediately next to the left border (as expected) but the top doesn't do the same.  Why, and how do I get rid of that whitespace?  Thanks.

-- Rick
Question by:MinnRick
LVL 22

Accepted Solution

Kim Walker earned 2000 total points
ID: 37021296
Default line-height value? Try setting a line-height equal to the font-size (or less). Some fonts have built-in white space above and below, too.

Author Closing Comment

ID: 37021496
That must've been it.  Adjusting the line-height worked fine.  Thanks XM.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question