I am making use of CSS to use my Lettera font, when taking my web development to production some browsers do not see the same font style, the following are the definitions that I am using in my CSS file:
.parrafoVerde {
padding: 30px;
font-size: 3vmin;
position: center;
font-family: Lettera Text Std;
}
.IndustriaTexto {
padding: 15px;
/* font-size: 3vmin; */
font-size: 20px;
padding-top: 0px;
font-family: Lettera Text Std;
}
<p class="parrafoVerde">
Lorem ipsum dolor sit amet consectetur adipiscing elit praesent, malesuada faucibus morbi litora nisi torquent pellentesque, integer facilisi nec maecenas cras nullam montes.
<p />
<p class="IndustriaTexto MoverNuestrasOperacionesIzquierda" >
Lorem ipsum dolor sit amet consectetur adipiscing elit praesent, malesuada faucibus morbi litora nisi torquent pellentesque, integer facilisi nec maecenas cras nullam montes.
</p>
In addition to this I am saving my font family to a location in a folder within the project.
But the problem persists that the font is not being taken from the other browsers, even using the same browser being Chrome.
I seem to realize that this happens because I don't have the font I'm using installed on the different computers.
Update:
I followed the guide recommended by @DavElsanto, but I still haven't found a solution, what I have done so far is the following as the guide says:
- I have my font in .OTF format which I later upload to Webfont Generator to create my Web Font Kit.
- Generate my Web Font Kit in extensions .TTF .WOFF .SVG .WOFF2
- Copy the CSS generated in the Web Font Kit into the style sheet, paste it as follows:
font-face
In addition to the fonts that I generated in the Web Font Kit, I added the one for my font in .OTF format to my CSS , but it still doesn't solve me.
@font-face {
font-family: 'Lettera Text Std';
src: url('Font/LetteraTextStd.woff2') format('woff2'),
url('Font/LetteraTextStd.woff') format('woff'),
url('Font/LetteraTextStd.ttf') format('truetype'),
url('Font/LetteraTextStd.svg#LetteraTextStd') format('svg'),
url('Font/LetteraTextStd-Títulos.otf') format('embedded-opentype');
font-weight: normal;
font-style: normal;
font-display: swap;
}
Update 2:
After adding all the possible font formats for the different browser versions they are as follows:
Update 3:
Checking the console for an error, I get the following:
It's probably just a source definition or path issue. I did a local test that works on Firefox, Chrome, Opera and Edge (Chromium based):
I downloaded the files from onlinewebfonts , only OTF, TTF and WOFF formats
I created an HTML document in the same folder where I downloaded the fonts
In CSS styles, I first declare the font:
Both the HTML, CSS and sources are in the same folder, that's why I don't put paths in
url("nombreDeArchivo.ext")
, in your case, you must specify the folder according to where you define the CSS rules, for example:In this case, the folder
Font
is insideCSS
and the styles file is at the same level; you must define the route withurl("Font/nombreDeArchivo.ext")
But, if the directory structure is different, something like:
The folder
Font
is at the same level asCSS
and the styles file at a different level from the source; you must take a step back../
to access:url("../Font/nombreDeArchivo.ext")
According to the documentation , it is convenient to define the font you want and, separated by commas, other similar fonts in case the main one could not be downloaded and applied.
Still having problems?
It's probably because you want to load additional styles using the same rule and, for practical purposes, they can be considered as different fonts, so to load the title font you have to do it separately:
Just remember, load all the fonts first and then create the rules to apply them.
Update:
To try to avoid noticeable font change on page load, you can try preloading content
The first problem is that you have multiple font files to upload and you will need to create a tag for each of them as suggested here :
Your code is going to be left with a lot of lines for font preloading and might not be as easy to maintain.
I suggest you create a specific CSS file for fonts and be the one you add as preloaded content:
Try importing your font with font-face, do the following at the top of your CSS:
with that it should work, greetings!
If you have already verified that the source paths are correct, try making a few small syntax changes.
First avoid starting the names of the Classes and IDs with capital letters:
Change .IndustryText to .industryText (remember to do it in the css and html respectively)
Then add quotes to your font name: