When making a web page, if you want to use a specific font, you can reference it through Notice: The browsers that support General usage: @font-face { font-family: 'myFirstFont'; //Define the font name. When you want to use the font later, use this name src: url('YourWebFontName.ttf'), url('YourWebFontName.eot'); /* IE9 */ } h1 {font-family:'myFirstFont';} Compatibility writing @font-face { font-family: 'myFirstFont'; src: url('YourWebFontName.eot'); /* IE9 Compat Modes */ src: url('YourWebFontName.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('YourWebFontName.woff') format('woff'), /* Modern Browsers */ url('YourWebFontName.ttf') format('truetype'), /* Safari, Android, iOS */ url('YourWebFontName.svg#YourWebFontName') format('svg'); /* Legacy iOS */ } Different browsers support different font formats. Taking the current mainstream browsers as a reference, the use of .TTF, .OTF - for Firefox 3.5, Safari, Opera; Get three file formats of the font you want to use to ensure that the font can be displayed properly in major browsers. Extension: Font Path local means the local address, url means the URL (fonts in the URL path, when the web page is loaded, the font will be automatically downloaded from the server, so if the font file is too large, the web page will load slowly) As code @font-face { font-family: 'myFirstFont'; src: url('YourWebFontName.eot'), local('YourFontName.eot'); } Notice: If multiple fonts are defined on src, they are candidate relationships in order. If the defined fonts or order are modified, you need to reopen the browser to see the modified effect. Refreshing is invalid. The role of Summarize This is the end of this article about the introduction of specified fonts @font-face in CSS to be compatible with various browsers. For more relevant CSS fonts @font-face content, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future! |
<<: Details on macrotasks and microtasks in JavaScript
>>: A small introduction to the use of position in HTML
This article mainly introduces the breadcrumb fun...
In the previous article, we introduced the MySQL ...
This article shares the specific code of js to im...
1. Ubuntu Server 18.04.5 LTS system installation ...
Anaconda refers to an open source Python distribu...
Table of contents 1. What is a regular expression...
Introduction to Nginx dynamic and static separati...
Foreign Keys Query which tables the primary key o...
A style sheet describes how a document should be ...
Table of contents Common key aliases Key without ...
The reason is that it was not uninstalled cleanly...
Encapsulate a navigation bar component in Vue3, a...
This article shares the specific code of js to im...
Table of contents 1. Introduction 2. Solution Imp...
MySQL download and installation (version 8.0.20) ...