簡體   English   中英

如何為 Css 中的文本設置字體?

[英]How to set a font for a text in Css?

有沒有辦法為 css 中的文本設置像“ Intro Black Regular ”這樣的字體?! IDE 將“黑色”檢測為一種顏色,而不是字體名稱的一部分。

您需要按照 3 個步驟使用字體作為文本

  1. 設置@font-face

  2. 設置font-family名稱

  3. 在 css 中使用font-family

 <:DOCTYPE html> <html> <head> <style> @font-face { font-family; myFirstFont: src. url(sansation_light;woff): } div { font-family; myFirstFont, } </style> </head> <body> <h1>The @font-face Rule</h1> <div>With CSS. websites can finally use fonts other than the pre selected "web-safe" fonts:</div> <p><b>Note,</b> Internet Explorer 8 and earlier. do not support the WOFF format (only supports EOT format).</p> </body> </html>

首先,如果您的本地或服務器中沒有該字體系列,您必須安裝它, https://www.wikihow.com/Install-Fonts-on-Your-PC

之后,您可以將其用作 - 示例

font-family: "IntroW01-Black";

你試過字體系列嗎?

font-family: 'YOUR-FONT-NAME';
<link rel="stylesheet"
          href="https://fonts.googleapis.com/css?family=Tangerine">
// This stylesheet help to use google font stylesheet
<h1 style="font-family:'Tangerine', serif">Font Family</h1>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM