5_字体相关语法2.html 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. <style>
  9. div{
  10. width: 300px;
  11. height: 50px;
  12. background: #f00;
  13. /* 字体相关属性 */
  14. /* 字体 */
  15. font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  16. /* 浏览器默认字体大小16px 浏览器支持的最小字体大小12px */
  17. font-size:12px;
  18. /* 字体粗细 100-900 默认值400 700|bold*/
  19. font-weight:700;
  20. /* 字体样式italic 斜体|normal正常 */
  21. font-style: italic;
  22. color:aqua;
  23. /* 文本相关属性 */
  24. /* 文本水平对齐 left|center|right*/
  25. text-align: center;
  26. /* 文本垂直居中 通过line-height=height 实现单行文本垂直居中*/
  27. line-height:50px;
  28. /* 文本首行缩进 */
  29. text-indent:30px;
  30. }
  31. </style>
  32. </head>
  33. <body>
  34. <div>我是一个DIV</div>
  35. </body>
  36. </html>