5_字体文本相关属性.html 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. /* 字体大小 浏览器中默认字体大小16px; 浏览器支持的最小字体大小12px*/
  15. font-size: 16px;
  16. /* 字体粗细 100-900 默认值400 */
  17. font-weight: 400;
  18. /* 字体 */
  19. font-family: 'Times New Roman', Times, serif;
  20. /* 字体样式 italic斜体|normal正常 */
  21. font-style:italic;
  22. /* 文本相关 */
  23. /* 水平对齐方式 left right center*/
  24. text-align:center ;
  25. /* 单行文本垂直对齐 行高=高 */
  26. line-height:50px ;
  27. /* 文本缩进 */
  28. text-indent: 20px;
  29. }
  30. </style>
  31. </head>
  32. <body>
  33. <div>
  34. 我是div1 哈哈哈哈
  35. </div>
  36. </body>
  37. </html>