一,效果圖。css
二,代碼。html
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>CSS Fonts(字體)</title> <style> body { font-size: 100%; } h1 { font-style: normal; font-size: 40px; font-size: 2.5em; } p.serif { font-family: "Times New Roman", Times, serif; font-style: italic; font-size: 30px; font-size: 1.875em; } p.sansserif { font-family: Arial, Helvetica, sans-serif; font-style: oblique; font-size: 14px; font-size: 0.875em; } </style> </head> <body> <h1>css font-family</h1> <p class="serif">this is a paragrapth,shown in the times new Roman font.</p> <p class="sansserif">this is a paragraph,shown in the arial font.</p> </body> </html>
參考資料:《菜鳥教程》字體