css 中文文字字体_使用CSS的网络字体
css 中文文字字體
CSS | 網絡字體 (CSS | Web fonts)
Web fonts allow people to use fonts that are not pre-installed in their computers. When you want to include a particular font simply include the font file on your browser and it will be downloaded.
Web字體允許人們使用計算機中未預裝的字體。 當您想包含特定字體時,只需在瀏覽器中包含字體文件,即可下載該文件。
Your fonts are specified within the CSS @font-face rule.
您的字體在CSS @ font-face規則中指定。
In this rule firstly specify the name of the font you wish to use and point to the font file.
在此規則中,首先指定要使用的字體名稱,然后指向字體文件。
不同的網絡字體格式 (Different web font formats)
TrueType Fonts(TTF):
TrueType字體(TTF) :
This is a standard font developed by Apple and Microsoft in the late 1980s. TrueType is the most commonly used font format for both the Mac OS and Microsoft Windows operating systems.
這是Apple和Microsoft在1980年代后期開發的標準字體。 TrueType是Mac OS和Microsoft Windows操作系統最常用的字體格式。
OpenType fonts(OTF):
OpenType字體(OTF) :
This is a format for scalable computer fonts developed by Microsoft. OpenType fonts are widely used today on the major computer platforms.
這是Microsoft開發的可縮放計算機字體的格式。 如今,OpenType字體已在主要計算機平臺上廣泛使用。
Web Open Font Format (WOFF):
Web開放字體格式(WOFF) :
It is a font format for use in web pages. It was developed in 2009. This font format is essentially OpenType or TrueType with compression and additional metadata. Its goal is to support font distribution between a server and a client over a network with bandwidth constraints.
它是一種用于網頁的字體格式。 它于2009年開發。此字體格式本質上是OpenType或TrueType,帶有壓縮和其他元數據。 它的目標是支持具有帶寬限制的網絡上的服務器和客戶端之間的字體分配。
SVG Fonts/Shapes:
SVG字體/形狀 :
These fonts allow SVG to be used as glyphs when displaying text. You can also apply CSS to SVG documents and to the SVG documents text the @font-face rule can be applied.
這些字體允許在顯示文本時將SVG用作字形。 您還可以將CSS應用于SVG文檔,也可以將@ font-face規則應用于SVG文檔文本。
Embedded OpenType Fonts (EOT):
嵌入式OpenType字體(EOT) :
EOT fonts designed by Microsoft are a compact form of OpenType fonts used as embedded fonts on web pages.
Microsoft設計的EOT字體是OpenType字體的緊湊形式,用作網頁上的嵌入式字體。
Syntax:
句法:
@font-face {font-family: myFirstFont;src: url(sansation_light.woff); }Note: Always use lower case letters for font url.
注意:字體URL始終使用小寫字母。
Example:
例:
<!DOCTYPE html> <html><head><style>@font-face {font-family: myFirstFont;src: url(sansation_light.woff);}* {font-family: myFirstFont;}</style> </head><body><div>This is a web font i wish to include in my browser.</div> </body></html>Output
輸出量
In the above example, a sansation_light web font is used. In location, we have specified the direct location of the font as it was in our folder that contained the main file you need to use the correct location of the file of the font to add it to your website. Using a direct URL is also possible.
在上面的示例中,使用了sansation_light Web字體 。 在位置中,我們已經指定了字體的直接位置,因為它在包含主文件的文件夾中,因此您需要使用該字體文件的正確位置將其添加到您的網站。 也可以使用直接URL。
CSS Font Descriptors
CSS字體描述符
font-family: It is used to define the name of the font you wish to use.
font-family :用于定義您要使用的字體的名稱。
src: It is used to specify the URL of the web font.
src :用于指定Web字體的URL。
font-stretch: It is used to specify how to font should be stretched. Some values are normal, condensed, ultra-condensed, etc.
font-stretch :用于指定應如何拉伸字體。 一些值是normal , condensed , ultra-condensed等。
font-style: It is used to specify the style you wish to use for the font. There are three values: normal, italic and oblique.
font-style :用于指定希望用于字體的樣式。 有三個值: 正常 , 斜體和傾斜 。
font-weight: It is used to define the boldness of the font used. Its values are normal and bold.
font-weight :用于定義所用字體的粗體。 其值是正常和粗體 。
翻譯自: https://www.includehelp.com/code-snippets/web-fonts-using-css.aspx
css 中文文字字體
總結
以上是生活随笔為你收集整理的css 中文文字字体_使用CSS的网络字体的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: c++ abort 函数_C ++中带有
- 下一篇: 适用于各种列表操作的Python程序