I decided to go deeper and I came to that answer:
To define what type of source to use in any code snippet HTML
, through the CSS
, we should use the property font-family
with the name of the source you want.
Thus, the syntax for defining and using a font in CSS
is:
font-family: "Nome da Fonte";
One can build the entire design of your site based on a source, and your reader simply won’t see the source because it isn’t installed or didn’t come on your computer’s operating system.
And now, what can be done to make it not occur?
One of the solutions to this problem is to give a list of sources as value, for the "font-family"
, comma-separated.
There are two types of font family names:
• Family-name - The name of a source-family, such as "times", "courier", "Arial", etc.
• Generic-family - The name of a generic family, such as "Serif", "sans-Serif", "cursive", "fantasia", "monospace".
The CSS
will attempt to style with the first source declared, if it exists on the player’s computer, it will be displayed, and if it is not present, the style CSS
will attempt to be done with the second source.
And finally, if you don’t have any of the source on the user’s computer, browser
will display a standard system source.
Syntax of Generic-family:
font-family: "Arial", "Verdana", "sans-Serif";
Start with the desired font and always end with a generic family, to allow the browser to choose a similar font in the generic family, if no other font is available.
Another and widely used solution is the: @font-face
, you must first set a name for the source (for example, myfont) and then point to the source file. See:
@font-face {
font-family:'minhafonte';
src:url("../fonts/bubblegum-sans-regular.otf");
}
div {
font-family:minhafonte;
}
And finally we can use one of the simplest and most guaranteed forms that are the sources of Google Web Fonts, because they are their own sources for web
and all tested and approved by the google platform.
To do this you must specify the source path provided on google fonts
, soon after the source is installed and ready to use, we have to use the specific name that the site provides to work properly. Take an example:
@import url('https://fonts.googleapis.com/css?family=Titillium+Web');
Ultilizando a fonte na tag
desired:
h1 {
font-family: 'Titillium Web', sans-serif;
}
In addition to the security of using fonts from Google Web Fonts, we also have the facility, without needing to download anything, just copying the path of the desired font that is already hosted on google servers and specifying its name in your CSS file.
References:
https://www.w3schools.com/cssref/css3_pr_font-face_rule.asp
https://www.w3schools.com/cssref/pr_font_font-family.asp
http://www.criarsites.me/como-utilizar-fontes-google-web-fonts/
https://tonyblack10.gitbooks.io/css/content/fonts/index.html
http://www.htmlprogressivo.net/2014/02/
This response also contains full content from websites such as this or this without the provenance being indicated. Please correct this.
– Sergio
@Sergio Corrigi. I didn’t know it worked that way, but from now on I’ll be more attentive about it. I am grateful, I take this as tips to improve future answers.
– Alicia Tairini