Fonts won't work from different folder? - html

So I have a font folder and a css folder as a sibling, when I refer to the fonts it works only when the .html file is a sibling with the font folder, however it will use the styling css file correctly. Let me clear it up with this image:
I'm refering to global_style.css from every index.html, and get correct styling in every index.html but the fonts will only work with the one which is not in any sub folders...
I have this in my root/subfolder1/index.html
<link rel="stylesheet" type="text/css" href="css/global_style.css"/>
And this in every other index.html:
<link rel="stylesheet" type="text/css" href="../css/global_style.css"/>
I suppose it should be working.
Here is my global_style.css:
#font-face{
font-family:"SourceSans";
src: url('../fonts/SourceSansPro.otf');
font-weight: normal;
font-style: normal;
}
#font-face{
font-family:"SourceSansIt";
src: url('../fonts/SourceSansProIt.otf');
font-weight: normal;
font-style: normal;
}
#font-face{
font-family:"SourceSansB";
src: url('../fonts/SourceSansProB.otf');
font-weight: normal;
font-style: normal;
}
#font-face{
font-family:"AllerBld";
src: url('../fonts/Aller_Bd.ttf');
font-weight: normal;
font-style: normal;
}
body {
-webkit-font-smoothing: antialiased !important;
-moz-osx-font-smoothing: grayscale;
font-smooth: always;
font-family:"SourceSans";
font-size: 14px;
color:white;
}

You can always use absolute path to load the fonts:
#font-face{
font-family:"SourceSans";
src: url('http://www.yoursite.com/root/subfolder1/fonts/SourceSansPro.otf');
font-weight: normal;
font-style: normal;
}
#font-face{
font-family:"SourceSansIt";
src: url('http://www.yoursite.com/root/subfolder1/fonts/SourceSansProIt.otf');
font-weight: normal;
font-style: normal;
}
#font-face{
font-family:"SourceSansB";
src: url('http://www.yoursite.com/root/subfolder1/fonts/SourceSansProB.otf');
font-weight: normal;
font-style: normal;
}
#font-face{
font-family:"AllerBld";
src: url('http://www.yoursite.com/root/subfolder1/fonts/Aller_Bd.ttf');
font-weight: normal;
font-style: normal;
}
body {
-webkit-font-smoothing: antialiased !important;
-moz-osx-font-smoothing: grayscale;
font-smooth: always;
font-family:"SourceSans";
font-size: 14px;
color:white;
}

Related

CSS Font issue on iOS Phone

There is a problem with fonts on iOS devices, these are the differences:
ANDROID/WEB IMAGE (correct)
IOS IMAGE (wrong)
The text appears to be in italics but I have never set it.
This is my font-face:
#font-face {
font-family: "Acumin Variable Concept";
src: url("font/Acumin/Acumin-Variable-Concept.ttf") format("truetype");
font-style: normal;
font-weight: 200;
font-display: swap;
}
#font-face {
font-family: "Acumin Variable Concept";
src: url("font/Acumin/Acumin-Variable-Concept.ttf") format("truetype");
font-style: normal;
font-weight: 400;
font-display: swap;
}
#font-face {
font-family: "Acumin Variable Concept";
src: url("font/Acumin/Acumin-Variable-Concept.ttf") format("truetype");
font-style: normal;
font-weight: 600;
font-display: swap;
}
#font-face {
font-family: "Acumin Variable Concept";
src: url("font/Acumin/Acumin-Variable-Concept.ttf") format("truetype");
font-style: normal;
font-weight: 900;
font-display: swap;
}
/* Typography */
p{
font-family:'Acumin Variable Concept';
font-size: 1.5rem;
text-align: justify;
line-height: 2rem;
font-weight: 400;
-webkit-font-smoothing: antialiased;
margin-bottom: 2rem;
}
b{
font-weight: 600;
color: var(--brand);
}
What could it be?
Thanks in advance,
Simone
you can try to set behind your font an "!important" like
font-family: "Acumin Variable Concept" !important;
regards
Jonas

Self hosted google font not smooth in any browser

I got the "Lato" google font and want to self-host it (because of performance). I got it implemented and it looks shitty and not smooth in any browser, it looks really pixelated!
#font-face {
font-family: 'lato';
src: url('font/latoFont.eot');
src: url('font/latoFont.eot?#iefix') format('embedded-opentype'),
url('font/latoFont.ttf') format('truetype'),
url('font/latoFont.woff2') format('woff2'),
url('font/latoFont.woff') format('woff');
font-weight: 500;
font-style: normal;
}
html {
font-family: 'lato', sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
font-size: 10px;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1.4rem;
color: #212121;
}
What can i do to get more satisfying and smooth results?
I usually use this hotfix
/*FIX FONT FOR GOOGLE CHROME ON WINDOWS*/
#media screen and (-webkit-min-device-pixel-ratio:0) {
#font-face {
font-family: 'MyFont';
src: url('fonts/myfont.svg#myfont') format('svg');
font-weight: normal;
font-style: normal;}
}
You can read more here

Can't figure out why the font for my logo isn't working

I'm trying to figure out why the font for my logo isn't downloading for other people. The font is called Aerokids.
The code in my CSS works fine for the other font type I have on my site. It's just the logo that's not working, even though it's done the same way. Does anyone have any ideas what might be wrong? Here is a screenshot of the fonts I have in the subfolder for my site:
Here is the GitHub URL for the site I'm working on.
#font-face {
font-family: 'Aerokids';
src: url('fonts/Aerokids.otf');
font-weight: normal;
font-style: normal;
font-family: 'odudo-semibold';
src: url('../fonts/odudo-semi-bold.eot');
src: url('../fonts/odudo-semi-bold.eot?#iefix') format('embedded-
opentype'),
url('../fonts/odudo-semi-bold.woff2') format('woff2'),
url('../fonts/odudo-semi-bold.woff') format('woff'),
url('../fonts/odudo-semi-bold.ttf') format('truetype'),
url('../fonts/odudo-semi-bold.svg#youworkforthem') format('svg');
font-weight: normal;
font-style: normal;
}
.logo {
font-family: 'Aerokids';
font-weight: normal;
color: #00E8FF;
font-size: 2.5em;
float: left;
width: 30%;
display: inline-block;
max-width: 100%;
height: auto;
vertical-align: middle;
margin: 0 auto;
}
You need to separate the two #font-face rules.
#font-face {
font-family: 'Aerokids';
src: url('fonts/Aerokids.otf');
font-weight: normal;
font-style: normal;
}
#font-face {
font-family: 'odudo-semibold';
src: url('../fonts/odudo-semi-bold.eot');
src: url('../fonts/odudo-semi-bold.eot?#iefix') format('embedded-
opentype'),
url('../fonts/odudo-semi-bold.woff2') format('woff2'),
url('../fonts/odudo-semi-bold.woff') format('woff'),
url('../fonts/odudo-semi-bold.ttf') format('truetype'),
url('../fonts/odudo-semi-bold.svg#youworkforthem') format('svg');
font-weight: normal;
font-style: normal;
}

How to include a specific font family not found at Google Fonts?

I want to use a font type called Daniel, but it's not found at Google Fonts.
Is there any way to use this type of font at my web site?
You have to download fonts files and delcare a font-face in your css.
You can check www.w3schools.com for more details. Here is an example :
#font-face {
font-family: Montserrat;
src: url("./fonts/Montserrat-Regular.otf");
font-weight: normal;
font-style: normal;
}#font-face {
font-family: Montserrat;
src: url("./fonts/Montserrat-Bold.otf");
font-weight: bold;
font-style: normal;
}#font-face {
font-family: Montserrat Light;
src: url("./fonts/Montserrat-Light.otf");
font-weight: normal;
font-style: normal;
}#font-face {
font-family: Montserrat Thin;
src: url("./fonts/Montserrat-Thin.otf");
font-weight: normal;
font-style: normal;
}#font-face {
font-family: Montserrat Medium;
src: url("./fonts/Montserrat-Medium.otf");
font-weight: normal;
font-style: normal;
}#font-face {
font-family: Montserrat SemiBold;
src: url("./fonts/Montserrat-SemiBold.otf");
font-weight: normal;
font-style: normal;
}

Mapping font-face to achieve the same font

#font-face {
font-family: "EurekaSans";
src: url("fonts/EurekaSans-Regular.otf");
font-weight: normal;
font-style: normal;
}
#font-face {
font-family: "EurekaSans";
src: url("fonts/EurekaSans-Bold.otf");
font-weight: bold;
font-style: normal;
}
#font-face {
font-family: "EurekaSans";
src: url("fonts/EurekaSans-RegularItalic.otf");
font-style: italic, oblique;
font-weight: normal;
}
#font-face {
font-family: "EurekaSans";
src: url("fonts/EurekaSans-MediumItalic.otf");
font-weight: bold;
font-style: italic, oblique;
}
Here I am trying to map the different fonts according to font-weight and font-style, however it does not do the job.. It only uses the italic version. Anyone spot the issue?