Link to home
Start Free TrialLog in
Avatar of designaire
designaireFlag for United States of America

asked on

fonts not working from another folder

I have a website and using fonts though css and they work fine. When I make a new folder for some of the html files, the font's don't show up. Do I need to have the fonts in that folder also? When I saved the html file it updated all the links so the fonts should be working.
Avatar of Gary
Gary
Flag of Ireland image

Without a link or some code and folder structure we have no idea.
Are you using standard fonts in your CSS expected to be on the client computer (arial, times roman, tahoma etc.)? Or are they embedded fonts?

Check the path to the CSS as referenced from the HTML. If it is relative to the position of the HTML files, the CSS might not be found if you move them.

As GaryC123 posted, some example code would definitely help.
Avatar of designaire

ASKER

Then are embedded fonts and they do work until I put files in a folder called order. If I save the html file to another folder the links should update. I didn't know if there were rules about where fonts have to be. Not sure if this makes sense.

folder-css - mainMedia.css

      @font-face {
    font-family: 'permiansanstypefaceregular';
    src: url('../fonts/PermianSansTypeface-Bold-webfont.eot');
    src: url('../fonts/PermianSansTypeface-Bold-webfont.eot?#iefix') format('embedded-opentype'),
         url('../fonts/PermianSansTypeface-Bold-webfont.woff') format('woff'),
         url('../fonts/PermianSansTypeface-Bold-webfont.ttf') format('truetype'),
         url('../fonts/PermianSansTypeface-Bold-webfont.svg#permiansanstypefaceregular') format('svg');
    font-weight: normal;
    font-style: normal;
      }

folder-fonts - fonts - this is where the fonts are


files.html
   <link rel="stylesheet" media="all" href="css/mainMedia.css" />





folder-order
order file.html - the fonts don't work in here but the css code does.

   <link rel="stylesheet" media="all" href="../css/mainMedia.css" />
Do you have a link to the site, it's hard to understand your structure from your comment.
try using the absolute path right from http:// 

If that works then the path you are using does not resolve from the css folder, and a better organization would be to have /fonts as a sub-directory of /css anyway.

Cd&
I would suggest to keep all your fonts and css in a single folder and to access it using url

for eg

we can use these mainMedia.css by using this link
So that you don't have to write the font css again.
<link rel="stylesheet" type="text/css" href="http://yourdomain/styles/mainMedia.css" />

considering below css as working with your font


folder-css - mainMedia.css

      @font-face {
    font-family: 'permiansanstypefaceregular';
    src: url('/fonts/PermianSansTypeface-Bold-webfont.eot');
    src: url('/fonts/PermianSansTypeface-Bold-webfont.eot?#iefix') format('embedded-opentype'),
         url('/fonts/PermianSansTypeface-Bold-webfont.woff') format('woff'),
         url('/fonts/PermianSansTypeface-Bold-webfont.ttf') format('truetype'),
         url('/fonts/PermianSansTypeface-Bold-webfont.svg#permiansanstypefaceregular') format('svg');
    font-weight: normal;
    font-style: normal;
      }
ASKER CERTIFIED SOLUTION
Avatar of designaire
designaire
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial