views:

40

answers:

2

Hi there, I'm having a strange issue with some @font-face text where there is some strange padding (or at least vertical space) included with the text. It is causing problems because I want to text to be positioned a certain way but can't have it overlapping other things. Here is a picture of what is occurring:

As you can see when the text is selected, the text overlaps some of the navigation bar above it. I have tried adjusting the line height and padding, margins, anything I can think of. Here is the relevant CSS, does anybody have a suggestion as to how I can get the height of the line to be around the height of the actual text.

  *{ margin: 0; padding: 0; }
  h1#logo { font: 350px/.95 'Bebas Neue'; color: #DDD; text-align: center; margin: 1px 0; }

EDIT: Here is a live example of the problem: http://codezroz.com/stuff/hello.html

+1  A: 

never seen the /.95 syntax before, but after a few tests now i belive it works like:
line-height = 0.95 * font-size = 332.5
so i think that's your problem, the font is taller than the line
adding overflow: hidden; on the H1 should be enough

y34h
That syntax is the correct syntax for the `font` shorthand property. The usage is `font-size/line-height`. Numbers without units are treated as percentages so you're conclusion is correct, though your answer is now essentially the same as mine ;)
Yi Jiang
A: 

Well, applying overflow: hidden to h1#logo stopped the selection highlight from bleeding into areas that were outside the element.

Also remember that you can use the :selection pseudo-element to change the color of the selected text.

Yi Jiang