2

I noticed that when my web page was loading, all of the CSS files loaded first, then the fonts after all of those were done. Is there a way to make the fonts start loading at the same time as the stylesheets?

I'm using @font-face with a url. Would encoding the font in the stylesheet solve this problem?

Alfred Xing
  • 4,406
  • 2
  • 23
  • 34
  • The fonts are defined within the stylesheet, so you can't really load them before the stylesheet. Are you sure that they aren't loading at the same time and because the fonts are bigger, they take longer to load? – Blender Dec 10 '12 at 03:50
  • @Blender Sorry for the confusion there. I am not currently embedding the fonts, only putting that up as a possibility for an answer to the question. – Alfred Xing Dec 10 '12 at 04:20

1 Answers1

0

i haven't experienced this kind of scenario of yours..i'am fond of using embedded fonts on my webpages..i would like to share what i did as what i see to make them synch on web page load..i have a font.css where i embed all the fonts i needed like this:

@charset "utf-8";
/* CSS Document for Fonts :)*/

@font-face{ 
font-family: trajan;
src:url(../fonts/TrajanPro-Regular.otf);
}

and the url resides on the directory inside the web app..i just link this to the web page then use the defined font on other css directly..hope i got your point and explained the right thing..thank you

Vainglory07
  • 5,073
  • 10
  • 43
  • 77
  • 1
    I don't think putting the `@font-face` code makes the fonts load _with_ the CSS files... – Alfred Xing Dec 10 '12 at 04:19
  • actualy my point is that to include all of the fonts you're using in another css file(external file i should say) if it's not way the you do:) – Vainglory07 Dec 10 '12 at 04:52
  • But would that make the font files load at the same time as the CSS files? – Alfred Xing Dec 11 '12 at 02:46
  • you might see this thread http://stackoverflow.com/questions/4712242/wait-for-fonts-to-load-before-rendering-web-page?rq=1 – Vainglory07 Dec 11 '12 at 07:38
  • 1
    That's not my question. I want to load the fonts at the same time as the stylesheets to decrease page load time. It's not a rendering problem. – Alfred Xing Dec 11 '12 at 22:07