简体   繁体   中英

How to set a font for a text in Css?

Is there a way to set font's like " Intro Black Regular " for text's in css?! The IDE detects ' Black ' as a color, not a part of font's name.

You need follow 3 steps to use font for text

  1. Setup @font-face

  2. Set font-family name

  3. Use font-family in css

 <: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>

First of all, if that font family is not available in your local or server, you have to install that, https://www.wikihow.com/Install-Fonts-on-Your-PC

after that you can use it as - example

font-family: "IntroW01-Black";

Did you try font-family?

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM