demo04-font.html 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>CSS字体样式</title>
  6. <!--
  7. CSS有五种通用字体
  8. -->
  9. <style>
  10. /*字体设置*/
  11. .font1{
  12. font-family: Serif; /*衬线字体*/
  13. font-style: normal; /*字体样式:正常显示*/
  14. font-size: 55px; /*字体大小:55px*/
  15. }
  16. .font2{
  17. font-family: SansSerif; /*无衬线字体*/
  18. font-style: italic; /*字体样式:斜体*/
  19. font-size: 5vw; /*字体大小:55vw vw:视口宽度,视口就是浏览器窗口的大小,
  20. 1vw=视口宽度的1%,如果视口宽度50厘米,1vw就是0.5厘米*/
  21. }
  22. .font3{
  23. font-family: Monospaced; /*等宽字体*/
  24. font-style: oblique; /*字体样式:字体倾斜*/
  25. }
  26. .font4{
  27. font-family: Cursive; /*草书字体*/
  28. font-weight: normal; /*字体粗细:正常显示*/
  29. }
  30. .font5{
  31. font-family: Fantasy; /*幻想字体*/
  32. font-weight: bold; /*字体粗细:加粗*/
  33. }
  34. </style>
  35. </head>
  36. <body>
  37. <p class="font1">
  38. 我是一段内容,Hello World! 123456。
  39. </p>
  40. <p class="font2">
  41. 我是一段内容,Hello World! 123456。
  42. </p>
  43. <p class="font3">
  44. 我是一段内容,Hello World! 123456。
  45. </p>
  46. <p class="font4">
  47. 我是一段内容,Hello World! 123456。
  48. </p>
  49. <p class="font5">
  50. 我是一段内容,Hello World! 123456。
  51. </p>
  52. </body>
  53. </html>