"; 2. Use the font-family attribute to set, the syntax format is "tag {font -family:"font style"}""/> "; 2. Use the font-family attribute to set, the syntax format is "tag {font -family:"font style"}"">
Home > Article > Web Front-end > How to set font in css
How to set fonts in css: 1. Use the font tag to set, the syntax format is ""; 2. Use the font-family attribute to set Settings, the syntax format is "tag {font-family: "font style"}"
The operating environment of this tutorial: Windows7 system, CSS3&&HTML5 version, Dell G3 computer .
1. Font tag configuration font
<font face="字体样式"></font>
Example:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <div>未设置字体的“你若盛开,蝴蝶自来”</div> <font face="华文中宋">设置字体的“你若盛开,蝴蝶自来”</font> </body> </html>
The font tag sets the face font attribute and its value can set different fonts
2. css setting font
css font setting word is font-family
Example:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> p{ font-family: 'Courier New', Courier, monospace; } </style> </head> <body> <p>设置字体的“你若盛开,蝴蝶自来”</p> <div>未设置字体的“百无禁忌”</div> </body> </html>
Effect :
Recommended learning: css video tutorial
The above is the detailed content of How to set font in css. For more information, please follow other related articles on the PHP Chinese website!