Table of Contents
What Is Web Font in CSS: Use Web Font in CSS is easier to understand when the core ideas are paired with practical examples. The sections below explain the topic clearly, highlight useful steps, and point out details that can prevent common errors.
Web font is the font that is put on the website by website designers, without installing on the user's computer.
To do this, you use a rule called @ font-face , which creates a identifier font and points to a font file stored on the Internet.
When users browse the web, they will automatically download the font and see the unique and strange font effects and may be "unique" only your website.
This guide, TipsMake.com will work with you to learn how to use @ fonf-face, invite you to follow it.
Common font formats
1. TrueType Font (TTF)
TrueType is a standard font, developed by Apple and Microsoft in the late 1980s. TrueType is the most popular font format for both MacOS and Microsoft Windows operating systems.
2. OpenType Font (OTF)
OpenType is a cross-platform computer font format and contains extended character sets, developed based on TrueType and trademarked by Microsoft. OpenType font is commonly used today on mainframe platforms.
3. The Web Open Font Format (WOFF)
WOFF is the format used to develop Webpage, developed by Mozilla and some other organizations in 2009. WOFF is essentially an OpenType or TrueType added with some descriptive data and part of its own format. yourself, making the transmission of the network lighter. W3C encourages the use of this format.
4. The Web Open Font Format (WOFF 2.0)
WOFF2 is an upgraded version of WOFF developed by Google with an average compression capability 30% higher than WOFF 1.0.
5. SVG Font / Shape
SVG Font is a font consisting of SVG characters (image - color or colorless), different from the normal font in that the letters are all images, so it has enough visual effects, such as dust effect, color, watercolor. SVG Font is never compressed and is typically quite large in size.
6. Embedded OpenType Fonts (EOT)
EOT , developed by Microsoft, is a compact OpenType format, designed to be used as embedded fonts on websites.
How to use @ font-face
To use @ font-face , we gather many CSS properties in combination with the font format to create the desired font types.
Attribute Value Description font-family name Specify a name for the font. src URL (Required) The path to where the font is located. font-stretch normal condensed ultra-condensed extra-condensed semi-condensed expanded semi-expanded extra-expanded ultra-expanded Specifies whether text is wider or narrower. The default value is "normal". font-style normal italic oblique (Optional) Define font-style. The default value is "normal". font-weight normal bold 100 200 300 400 500 600 700 800 900 (Optional) Determine the font-weight. The default value is "normal". unicode-range unicode-range Specifies the range of UNICODE characters that the font supports. The default value is "U + 0-10FFFF".For instance,
Example 1: Use the font you want
@font-face {font-family: FontTipsmake;src: url(sansation_light.woff);}div {font-family: FontTipsmake;}
Results show:

Full code:
@ font-face in CSS
My love - Westlife
An empty streetAn empty houseA hole inside my heartI'm all aloneThe rooms are getting smallerI wonder howI wonder whyI wonder where they areThe days we hadThe songs we sang togetherOh yeahAnd all my loveI'm holding on foreverReaching for the love that seems so farSo I say a little prayerAnd hope my dreams will take me thereWhere the skies are blueTo see you once again, my loveOver seas from coast to coastTo find the place I love the mostWhere the fields are greenTo see you once again, my love
Example 2: Use bold letters
@font-face {font-family: FontTipsmake;src: url(sansation_bold.woff);font-weight: bold;}
"sansation_bold.woff" is another font file, containing bold characters for Sansation fonts in example 1.
The browser will use this format whenever the text with the font "FontTipsmake" is bold.

Full code:
@ font-face in CSS
I Lay My Love on You - Westlife
Just a smile and the rain is goneCan hardly believe it (yeah)There's an angel standing next to meReaching for my heartJust a smile and there's no way backCan hardly believe it (yeah)But there's an angel and she's calling meReaching for my heartI know, that I'll be ok nowThis time it's realI lay my love on youIt's all I want to doEvery time I breathe I feel brand newYou open up my heartShow me all your love, and walk right throughAs I lay my love on you
Next lesson: 2D Transform in CSS
FAQ
What should you know about common font formats 1. TrueType Font (TTF)?
TrueType is a standard font, developed by Apple and Microsoft in the late 1980s. TrueType is the most popular font format for both MacOS and Microsoft Windows operating systems.
What should you know about 2. OpenType Font (OTF)?
OpenType is a cross-platform computer font format and contains extended character sets, developed based on TrueType and trademarked by Microsoft. OpenType font is commonly used today on mainframe platforms.
What should you know about 3. The Web Open Font Format (WOFF)?
WOFF is the format used to develop Webpage, developed by Mozilla and some other organizations in 2009. WOFF is essentially an OpenType or TrueType added with some descriptive data and part of its own format. yourself, making the transmission of the network.
Reader Comments 0
Sign in with email or Google to join the discussion.