Mobile app version of vmapp.org
Login or Join
Pierce454

: Performance hit of a lot of unused font-faces If you have an html file, and in that html file you link to styles.css which covers all the styling of the page. Then inside of styles.css

@Pierce454

Posted in: #Css3 #Fonts #Performance

If you have an html file, and in that html file you link to styles.css which covers all the styling of the page. Then inside of styles.css you have something like @import url('../css/fonts.css'). Fonts.css is just a couple dozen font-face declarations. Basically covering all of your bases.

If styles.css only uses one or two of those fonts, will there be a performance hit when the browser tries to download all of the unused fonts in fonts.css, or will it only download the ones it needs as it comes up?

Similarly, what happens if fonts.css was linked inside of the HTML file?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Pierce454

1 Comments

Sorted by latest first Latest Oldest Best

 

@Kristi941

@import in-and-of itself is slow. You shouldn't be using unless absolutely necessary and in this case I don't think it is. Just create a second <link> element to the style sheet with the font rules or include them in styles.css.

Unused font that needs to be downloaded will not be downloaded so declaring them but never using them will not hurt performance.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme