I have done some research on "embedding non-system built-in fonts in web pages" before. Although it is technically feasible, it does not have much practical significance in China, because a Chinese font file is at least 20M+, and the font files supported by each browser are different. In other words, there must be 2-3 font files of different formats on the server side to cope with each browser. You can see the corresponding picture below. I thought this little research I did before would not be useful in my future work, but it turned out to be useful. A customer requested to display the time, but the font of the time must be the same as that of a digital watch, as shown in the figure: First of all, we need to find this font. Since this font is only in ttf format, we need to convert it into various other formats. As for how to convert, there are software and online. I will not specify which one to use here. After the conversion, you can write the CSS code Copy code The code is as follows:@font-face { font-family: 'hooray'; /*Name your custom font*/ src: url('http://demo.jb51.net/js/2013/webfontry/hooray.eot'); src: url('http://demo.jb51.net/js/2013/webfontry/hooray.eot?#iefix') format('eot'), url('http://demo.jb51.net/js/2013/webfontry/hooray.woff') format('woff'), url('http://demo.jb51.net/js/2013/webfontry/hooray.ttf') format('truetype'), url('http://demo.jb51.net/js/2013/webfontry/hooray.svg#webfontjKg17VrE') format('svg'); } As for the call, just like usual, define font-family where needed, and the font name is the name just named: Copy code The code is as follows:font-family: 'hooray'; Download the complete demo. Online Demo I did not explain the reasons for many things in the article, because there is a lot of information on the Internet about "using arbitrary fonts on web pages", but there are few examples. If you don't understand something, just go to Baidu or Google and you will understand. Appendix 1: Two new online font conversion websites are added: FontsQuirrel and onlinefontconverter. |
<<: A brief discussion on how to solve the depends_on order problem in Docker-compose
>>: MySQL learning: five major constraints of database tables explained in detail for beginners
This article shares the specific code of js to im...
Preface If you want to count the source of websit...
Recently, I plan to deploy a cloud disk on my hom...
Remove the dotted box on the link Copy code The co...
download: Step 1: Open the website (enter the off...
Preface Because the mini program upload requires ...
1. Clarify the design direction <br />First,...
Function: Jump to the previous page or the next p...
Syn attack is the most common and most easily exp...
2.1 Semanticization makes your web pages better u...
The network configuration of Host Only+NAT mode u...
Preface As we all know, the browser's homolog...
Preface This article summarizes some implementati...
This article uses an example to illustrate the pa...
Solve the problem of eight hours time difference ...