views:

129

answers:

3

Hi all,

Having some trouble with the CSS alignment of text generated with @font-face. For some reason, there is a ton of extra space visible at the bottom of each letter, stretching the text's containing box too far downward.

If you inspect the text on this sample page, you can see what I mean.

Have googled and inspected a bunch of other pages, but this one's got me stumped. Any chance someone could help?

Thanks!

A: 

You are using <h2> tag there. for the h tags use the CSS style's margin and padding to remove those extra spaces.

<style>
h2 {
   margin:0;
   padding:0;
}
</style>
Muneer
Actually, he used a CSS reset to do just that.
Brock Adams
+2  A: 

For starters, the computed line-height is 65px, so you could always define it to be 60px if you wanted.

However, most of that space is actually just required by the font you chose. Though you've converted it to uppercase with your CSS, the font still needs room to render characters that draw below the text's baseline. Try adding a comma to that header's text, and you'll see it's actually pretty huge and should fill up most of the empty space.

Tim Stone
Good catch =) (+1)
David Thomas
The computed `line-height` drops down to 60px when the node is set back to `line-height: 1;`. But your absolutely right. When accounting for descenders, that text is centered properly.
Brock Adams
A: 

Hey Tim,

I also thought that would be the case, but I checked out some other sites with League Gothic embedded, they don't seem to have the issue.

Inspect the headlines on hugsformonsters.com, or snook.ca to see what I'm talking about.

Even when I adjust the line-heights, it still seems to want to distribute the space unevenly.

Jon
The apparently difference is just due to your larger font-size, actually. By modifying some CSS on your test page, I made your header's font size (and added in some text) the same as that on http://hugsformonsters.com/. Take a look at http://www.lftechnologies.net/misc/font-size.png to see the spacing comparison, and you'll find in reality it's just a result of scaling.
Tim Stone
Man, I'll be. It's just super pronounced when the font size is that big. Thanks for pointing that out.
Jon
No problem. I had to check myself to be sure that was the case, heh. It is quite a bit of space, but I imagine it shouldn't be too hard to style around if it becomes a problem.
Tim Stone