You could also define your font with @font-face
:
@font-face {
font-family: MainFont;
src: local('Lucida Sans Unicode'), local('Lucida Grande');
}
@font-face {
font-family: HeadlineFont;
src: local('Arial'), local('Helvetica');
}
@font-face {
font-family: SerifFont;
src: local('Georgia'), local('Times'), local('Times New Roman');
}
Unfortunately, the fall-back font types (sans-serif
, serif
, cursive
, monospace
, and fantasy
) don’t seem to work with local
(and I was unable to find a clear specification on this), but this still reduces your CSS to:
a {
font-family: MainFont, sans-serif;
}
Another trick to reduce the size of your CSS is to combine all selectors that use the same font with a comma:
h1, h2, h3, .headline, section > .title {
font-family: HeadlineFont, sans-serif;
}
Instead of the more verbose
h1 {
font-family: HeadlineFont, sans-serif;
}
h2 {
font-family: HeadlineFont, sans-serif;
}
h3 {
font-family: HeadlineFont, sans-serif;
}
…