Loading Please Wait...

Logo Lynxsia IT Solutions

CSS Font Family

CSS Font Family

The CSS font-family property specifies a prioritized list of one or more font family names and/or generic family names for the selected element.

Font Family

The font-family is a list of one or more family-name or generic-name values separated by comma.

Family Name

The name of font family: "Times", "Helvetica", "Georgia", "Gill Sans", "Gill Sans Extrabold", "Goudy Bookletter 1911", "Comic Sans MS", "Gill Sans Extrabold", "Times New Roman", Arial, Helvetica, "Lucida Console", "Courier New", etc.

Generic Name

The name of generic font family: serif, sans-serif, monospace, cursive, fantasy, system-ui, ui-serif, ui-sans-serif, ui-monospace, ui-rounded, emoji, math, fangsong

Global Values

initial, inherit, revert, revert-layer, unset.

					 
        
          /* A font family name */
          font-family: "Gill Sans Extrabold";
          font-family: "Goudy Bookletter 1911";

          /* A generic family name only */
          font-family: serif;
          font-family: sans-serif;
          font-family: monospace;
          font-family: cursive;
          font-family: fantasy;
          font-family: system-ui;
          font-family: ui-serif;
          font-family: ui-sans-serif;
          font-family: ui-monospace;
          font-family: ui-rounded;
          font-family: emoji;
          font-family: math;
          font-family: fangsong;

          /* A font family name and a generic family name */
          font-family: "Gill Sans Extrabold", sans-serif;
          font-family: "Goudy Bookletter 1911", sans-serif;

          /* Global values */
          font-family: inherit;
          font-family: initial;
          font-family: revert;
          font-family: revert-layer;
          font-family: unset;
        
      
Always use double quotes if the name of the font is more than one.
					 
        
          /* Valid */
          font-family: Gill Sans Extrabold;

          /* technically valid but not recommended */
          font-family: Gill Sans Extrabold;

          /* Invalid */
          font-family: "Gill" Sans Extrabold;
        
      
Fallback Fonts

It is normal that the primary font, we used, failed to load or install. In such cases another fonts or generic fonts can be used instead of the primary font.

Generic font families are a fallback mechanism, a means of preserving some of the style sheet author's intent when none of the specified fonts are available. Generic family names are keywords and must not be quoted. A generic font family should be the last item in the list of font family names.

					 
        
          /* fallback font */
          font-family: "Times New Roman", monospace;
        
      
In the above example, if "Times New Roman" font failed to load then generic font "monospace" is used by the browser.
It is a good practice to se fallback fonts.

How you feel about this blog:

Share this blog on:

Report Us

If you find any error in the turtorials, or want to share your suggestion/feedback, feel free to send us email at: info@lynxsia.com

Contact Us
Ads
Logo
Lynxsia IT Solutions

We are concern with various development process like website design & development, E-commerce development, Software development, Application development, SMS & Bulk SMS Provider, PWA Development, and many more..

Kotwali Road, Chhiptehri, Banda, 210001, UP, India

Copyright © 2022, Lynxsia IT Solutions, All rights reserved