The CSS @font-face Rule

    Web fonts allow Web designers to use fonts that are not installed on the user's computer.

    When you have found/bought the font you wish to use, just include the font file on your web server, and it will be automatically downloaded to the user when needed.

    Your "own" fonts are defined within the CSS @font-face rule.

    Different Font Formats

    TrueType Fonts (TTF)

    TrueType is a font standard developed in the late 1980s, by Apple and Microsoft. TrueType is the most common font format for both the Mac OS and Microsoft Windows operating systems.

    OpenType Fonts (OTF)

    OpenType is a format for scalable computer fonts. It was built on TrueType, and is a registered trademark of Microsoft. OpenType fonts are used commonly today on the major computer platforms.

    The Web Open Font Format (WOFF)

    WOFF is a font format for use in web pages. It was developed in 2009, and is now a W3C Recommendation. WOFF is essentially OpenType or TrueType with compression and additional metadata. The goal is to support font distribution from a server to a client over a network with bandwidth constraints.

    The Web Open Font Format (WOFF 2.0)

    TrueType/OpenType font that provides better compression than WOFF 1.0.

    SVG Fonts/Shapes

    SVG fonts allow SVG to be used as glyphs when displaying text. The SVG 1.1 specification define a font module that allows the creation of fonts within an SVG document. You can also apply CSS to SVG documents, and the @font-face rule can be applied to text in SVG documents.

    Embedded OpenType Fonts (EOT)

    EOT fonts are a compact form of OpenType fonts designed by Microsoft for use as embedded fonts on web pages.

    Browser Support for Font Formats

    The numbers in the table specifies the first browser version that fully supports the font format.

    Font format TTF/OTF 9.0* 4.0 3.5 3.1 10.0 WOFF 9.0 5.0 3.6 5.1 11.1 WOFF2 14.0 36.0 39.0 10.0 26.0 SVG Not supported Not supported Not supported 3.2 Not supported EOT 6.0 Not supported Not supported Not supported Not supported

    *IE: The font format only works when set to be "installable".

    Using The Font You Want

    In the @font-face rule; first define a name for the font (e.g. myFirstFont) and then point to the font file.

    Tip: Always use lowercase letters for the font URL. Uppercase letters can give unexpected results in IE.

    To use the font for an HTML element, refer to the name of the font (myFirstFont) through the font-family property:


    @font-face {   font-family: myFirstFont;   src: url(sansation_light.woff); }

    div {   font-family: myFirstFont; }

    Try it Yourself »

    Using Bold Text

    You must add another @font-face rule containing descriptors for bold text:


    @font-face {   font-family: myFirstFont;   src: url(sansation_bold.woff);   font-weight: bold; }

    Try it Yourself »

    The file "sansation_bold.woff" is another font file, that contains the bold characters for the Sansation font.

    Browsers will use this whenever a piece of text with the font-family "myFirstFont" should render as bold.

    This way you can have many @font-face rules for the same font.

    CSS Font Descriptors

    The following table lists all the font descriptors that can be defined inside the @font-face rule:

    Descriptor Values Description font-family name Required. Defines a name for the font src URL Required. Defines the URL of the font file font-stretch normal condensed ultra-condensed extra-condensed semi-condensed expanded semi-expanded extra-expanded ultra-expanded Optional. Defines how the font should be stretched. Default is "normal" font-style normal italic oblique Optional. Defines how the font should be styled. Default is "normal" font-weight normal bold 100 200 300 400 500 600 700 800 900 Optional. Defines the boldness of the font. Default is "normal" unicode-range unicode-range Optional. Defines the range of UNICODE characters the font supports. Default is "U+0-10FFFF"
    How do I import a font into CSS?
    The @font-face CSS rule explained below is the most common approach for adding custom fonts to a website.
    1. Step 1: Download the font.
    2. Step 2: Create a WebFont Kit for cross-browsing.
    3. Step 3: Upload the font files to your website.
    4. Step 4: Update and upload your CSS file.
    5. Step 5: Use the custom font in your CSS declarations.
    How do I import a font into Word?
    Right-click the fonts you want, and click Install. If you're prompted to allow the program to make changes to your computer, and if you trust the source of the font, click Yes. Your new fonts will appear in the fonts list in Word. more
    How do I import a font into PowerPoint?
    Embed the font in a presentation Go to the main PowerPoint menu on the upper-left corner. Select Options. Go to the Save options on the left. Find the embedding options at the very bottom and check Embed fonts in the file. more
    How do I import a font into publisher?
    Upload fonts
    1. Open Publisher Center.
    2. Select your publication.
    3. Click Publication settings. Visual styles.
    4. Go to Fonts.
    5. Click New font family.
    6. Name your font family.
    7. Click Add font.
    8. Once you upload, the "Font file" field populates with the name of the file.
    How do I import a font into Word on a Mac?
    To add fonts in Word on Mac, locate the font file and then double-click it. The Font Preview window will appear. Click “Install Font” in the bottom-right corner of the window. The font is now installed on your Mac and will appear in different apps such as Excel, PowerPoint, and Word. more
    How do I import a font into Illustrator?
    If you're using Windows, you can press Ctrl+click to select multiple font files, and then right-click on them and choose "Install". The fonts will automatically be added to your font library, and Illustrator will recognize them when you use the program again. more
    How do I import a font into Google Docs?
    To change it, click the downward arrow on the right side of the font type. At the top of the drop-down menu, select More Fonts. You'll see a list of fonts—left-click on any other fonts you would like to add. Select OK to complete the process. more
    How do I import a font into good notes?
    How to add new Fonts to GoodNotes & Free Font Download
    1. Open the app and click on “Import” in the upper left corner. Now select the font you want from your files.
    2. The new font will appear at iFont on the left, then click “Install”.
    3. Then go back to iFont, you will see that your font is now installed.
    How do I import a font into paint?
    How to Add Font to Paint
    1. Download the font that you would like to use in the caption for your picture.
    2. Unzip the downloaded font if it is compressed with a format such as ZIP.
    3. Double-click the file with the .
    4. Click the "Install" button at the top of the window.
    How do I import a font into premiere?
    Open Creative Cloud, click the Fonts button to open the Active Fonts workspace, then click Add Fonts to Creative Cloud. You'll now be able to drag and drop or select the font files you would like to be uploaded to your account for future use. more
    How do I import a font into PowerPoint on a Mac?
    Installing a custom font in Mac Double-click the font file to open the Font Book application. The font displays in a window, providing a preview of what it will look like in PowerPoint. And now it's installed, head over to PowerPoint (making sure to restart the program) and click the “Format” tab. more


    You may be interested in...

    Can you lose money on call options?

    How can I speed up my b2 visa?

    Which teeth are close to sinuses?

    What does it mean to rap a horse?

    How does a caracal move?

    How much money do I need in my bank account?

    Will bamboo choke out other trees?

    Are king prawns halal?

    Is warp speed possible?

    What comes next after PhD?

    Can you get the Child Tax Credit with no income?

    Which food make face glow?

    Can I make an NFT?

    Did Vikings go to Russia?

    How do I say orange in Italian?

    About Privacy Contact
    ©2022 REPOKIT