HTML CSS examples for CSS:Font
The font-family property should hold several font names as a "fallback" system.
If the browser does not support the first font, it tries the next font.
<!DOCTYPE html> <html> <head> <style> p.serif {<!-- w w w . j a va 2s . com--> font-family: "Times New Roman", Times, serif; } p.sansserif { font-family: Arial, Helvetica, sans-serif; } </style> </head> <body> <h1>CSS font-family</h1> <p class="serif">This is a paragraph, shown in the Times New Roman font.</p> <p class="sansserif">This is a paragraph, shown in the Arial font.</p> </body> </html>
Below are some commonly used font combinations, organized by generic family.
font-family | Example text |
---|---|
Georgia, serif | This is a headingThis is a paragraph |
"Palatino Linotype", "Book Antiqua", Palatino, serif | This is a headingThis is a paragraph |
"Times New Roman", Times, serif | This is a headingThis is a paragraph |
font-family | Example text |
---|---|
Arial, Helvetica, sans-serif | This is a headingThis is a paragraph |
"Arial Black", Gadget, sans-serif | This is a headingThis is a paragraph |
"Comic Sans MS", cursive, sans-serif | This is a headingThis is a paragraph |
Impact, Charcoal, sans-serif | This is a headingThis is a paragraph |
"Lucida Sans Unicode", "Lucida Grande", sans-serif | This is a headingThis is a paragraph |
Tahoma, Geneva, sans-serif | This is a headingThis is a paragraph |
"Trebuchet MS", Helvetica, sans-serif | This is a headingThis is a paragraph |
Verdana, Geneva, sans-serif | This is a headingThis is a paragraph |
font-family | Example text |
---|---|
"Courier New", Courier, monospace | This is a headingThis is a paragraph |
"Lucida Console", Monaco, monospace | This is a headingThis is a paragraph |