Search code examples
csswebfonts

Web fonts vertical spacing


I'm loading a web font using @font-face but the height of my elements changes slightly once the font is loaded because the vertical spacing is slightly different. It seems to use the vertical spacing of the default font or next font in the family before adjusting to the web font when it's loaded.

How do I tell the browser what the vertical spacing will be for the web font before it's loaded?


Solution

  • Setting the line-height property to a fixed-pixel value on your desired element will work.