How to set the font of text

Example analysis:

font - The family attribute specifies the font of an element.

The font-family property can save multiple font names as a "fallback" system. If the browser doesn't support the first font, it will try the next one.

There are two types of font family names:

family-name: Specified family name: the name of the specific font, such as: " times", "courier", "arial".

generic-family: Usually font family name: such as: "serif", "sans-serif", "cursive", "fantasy", "monospace.

Using a specific font family (Geneva) depends entirely on whether that font family is available on the user's machine; this attribute does not indicate any font download. Therefore, using a generic font family name as a fallback is highly recommended.

Note: Separate each value with a comma.

Note: If the font name contains spaces, it must be enclosed in quotes. In HTML When using the "style" attribute, you must use single quotes.


#
Continuing Learning
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文网(php.cn)</title> <style> p.serif{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">这一段的字体是 Times New Roman。</p> <p class="sansserif">这一段的字体是 Arial。</p> </body> </html>
submitReset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!