


How to correctly display the locally installed 'Jingnan Mai Round Body' on the web page?
Website integration local font: Solve the display problem of "Jingnan Mai Round"
After successfully installing the system font, how to call it correctly in the web page? This article will solve how to use the locally installed "Jingnan Mai Round" font on the website and avoid using src
attribute to directly introduce font files (because the file is larger).
Here is a common CSS code snippet trying to use local fonts:
/* @font-face { font-family: 'myfont'; src: url('/style1/font/Jingnanmai round body.otf') format('truetype'); } */ html, body { font-size: 18px; font-family: "Jingnan Mai Round Body", "Microsoft Yahei", "Helvetica Neue", Helvetica, Arial, sans-serif; }
Although "Jingnan Mai Round" is placed at the top of the font list, the web page still displays "Microsoft Yahei". The problem is that the browser cannot directly recognize the font file path installed locally.
Solution:
We need to correct the CSS code and correctly define and apply custom fonts.
-
Defining Fonts (@font-face): Although we do not use
src
to introduce font files directly, we still need the@font-face
rule to tell the browser the font name. The key is that we do not need to specify the font file path , and the browser will automatically look up from the system font library.@font-face { font-family: 'JingNanMaiYuanTi'; /* Use a cleaner font name*/ }
-
Apply font: In
font-family
property, use the font name defined in step 1.html, body { font-size: 18px; font-family: 'JingNanMaiYuanTi', "Microsoft Yahei", "Helvetica Neue", Helvetica, Arial, sans-serif; }
Through the above modifications, the browser will give priority to using a system font called "JingNanMaiYuanTi". If the font is installed on the system, the web page will be displayed correctly. If not installed, alternative fonts are used in turn.
Additional suggestions:
- Font name: Use a simpler, easy to remember font name, such as
JingNanMaiYuanTi
, avoid using names containing spaces or special characters. - Browser Cache: After modifying CSS, clear the browser cache or restart the browser to ensure that the browser loads the latest CSS rules.
With these adjustments, you should be able to successfully display the "Jingnan Mai Round" font on the web page, while avoiding loading speed issues caused by direct introduction of font files.
The above is the detailed content of How to correctly display the locally installed 'Jingnan Mai Round Body' on the web page?. For more information, please follow other related articles on the PHP Chinese website!

Linking CSS files to HTML can be achieved by using elements in part of HTML. 1) Use tags to link local CSS files. 2) Multiple CSS files can be implemented by adding multiple tags. 3) External CSS files use absolute URL links, such as. 4) Ensure the correct use of file paths and CSS file loading order, and optimize performance can use CSS preprocessor to merge files.

Choosing Flexbox or Grid depends on the layout requirements: 1) Flexbox is suitable for one-dimensional layouts, such as navigation bar; 2) Grid is suitable for two-dimensional layouts, such as magazine layouts. The two can be used in the project to improve the layout effect.

The best way to include CSS files is to use tags to introduce external CSS files in the HTML part. 1. Use tags to introduce external CSS files, such as. 2. For small adjustments, inline CSS can be used, but should be used with caution. 3. Large projects can use CSS preprocessors such as Sass or Less to import other CSS files through @import. 4. For performance, CSS files should be merged and CDN should be used, and compressed using tools such as CSSNano.

Yes,youshouldlearnbothFlexboxandGrid.1)Flexboxisidealforone-dimensional,flexiblelayoutslikenavigationmenus.2)Gridexcelsintwo-dimensional,complexdesignssuchasmagazinelayouts.3)Combiningbothenhanceslayoutflexibilityandresponsiveness,allowingforstructur

What does it look like to refactor your own code? John Rhea picks apart an old CSS animation he wrote and walks through the thought process of optimizing it.

CSSanimationsarenotinherentlyhardbutrequirepracticeandunderstandingofCSSpropertiesandtimingfunctions.1)Startwithsimpleanimationslikescalingabuttononhoverusingkeyframes.2)Useeasingfunctionslikecubic-bezierfornaturaleffects,suchasabounceanimation.3)For

@keyframesispopularduetoitsversatilityandpowerincreatingsmoothCSSanimations.Keytricksinclude:1)Definingsmoothtransitionsbetweenstates,2)Animatingmultiplepropertiessimultaneously,3)Usingvendorprefixesforbrowsercompatibility,4)CombiningwithJavaScriptfo

CSSCountersareusedtomanageautomaticnumberinginwebdesigns.1)Theycanbeusedfortablesofcontents,listitems,andcustomnumbering.2)Advancedusesincludenestednumberingsystems.3)Challengesincludebrowsercompatibilityandperformanceissues.4)Creativeusesinvolvecust


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Atom editor mac version download
The most popular open source editor

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
