designaire
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.
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.
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.
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: 'permiansanstypefaceregula r';
src: url('../fonts/PermianSansT ypeface-Bo ld-webfont .eot');
src: url('../fonts/PermianSansT ypeface-Bo ld-webfont .eot?#iefi x') format('embedded-opentype' ),
url('../fonts/PermianSansT ypeface-Bo ld-webfont .woff') format('woff'),
url('../fonts/PermianSansT ypeface-Bo ld-webfont .ttf') format('truetype'),
url('../fonts/PermianSansT ypeface-Bo ld-webfont .svg#permi ansanstype faceregula r') 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 " />
folder-css - mainMedia.css
@font-face {
font-family: 'permiansanstypefaceregula
src: url('../fonts/PermianSansT
src: url('../fonts/PermianSansT
url('../fonts/PermianSansT
url('../fonts/PermianSansT
url('../fonts/PermianSansT
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&
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: 'permiansanstypefaceregula r';
src: url('/fonts/PermianSansTyp eface-Bold -webfont.e ot');
src: url('/fonts/PermianSansTyp eface-Bold -webfont.e ot?#iefix' ) format('embedded-opentype' ),
url('/fonts/PermianSansTyp eface-Bold -webfont.w off') format('woff'),
url('/fonts/PermianSansTyp eface-Bold -webfont.t tf') format('truetype'),
url('/fonts/PermianSansTyp eface-Bold -webfont.s vg#permian sanstypefa ceregular' ) format('svg');
font-weight: normal;
font-style: normal;
}
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: 'permiansanstypefaceregula
src: url('/fonts/PermianSansTyp
src: url('/fonts/PermianSansTyp
url('/fonts/PermianSansTyp
url('/fonts/PermianSansTyp
url('/fonts/PermianSansTyp
font-weight: normal;
font-style: normal;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.