Blogger Information
Blog 5
fans 0
comment 0
visits 2622
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
005.css 之盒模型属性简写与em、rem的应用场景
清石
Original
542 people have browsed it

CSS 之盒模型属性简写与em、rem的应用场景

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>盒模型属性简写与em、rem的应用场景</title>
  6. <style type="text/css">
  7. :root {
  8. font-size: 0.625em;
  9. }
  10. body {
  11. background-color: #E0FFFF;
  12. }
  13. .ceshi {
  14. width: 460px;
  15. height: 500px;
  16. font-size: 2.8rem;
  17. color: #aa00ff;
  18. text-align: center;
  19. margin: 3em 2.5em;
  20. padding: 2em 3em 1.5em;
  21. border: 1px solid #4169E1;
  22. border-radius: 10px;
  23. background-color: #00aaff;
  24. }
  25. p {
  26. font-size: 1.8rem;
  27. text-align: left;
  28. color: #d145d1;
  29. }
  30. span {
  31. color: #ff557f;
  32. font-size: 2.2rem;
  33. }
  34. </style>
  35. </head>
  36. <body>
  37. <div class="ceshi">盒模型属性简写<br>与em、rem的应用场景
  38. <hr>
  39. <p>
  40. <span>1.盒模型中的属性简写</span><br>
  41. 当值四个时, 按顺时针排列 <br>
  42. 当值只有三个时,第一个上, 第二个表示左右, 第三个表示下 <br>
  43. 当值只有二个时,第一个表示上下, 第二个表示左右 <br>
  44. 当值只有二一个时,表示四周都相同 <br>
  45. </p>
  46. <p>
  47. <span>2.em </span><br>
  48. 当前字号的相对单位<br>
  49. 用在 padding,margin, border-radius,用 em 比较合适<br>
  50. px 通常用在边框上<br>
  51. </p>
  52. <p>
  53. <span>3.rem</span><br>
  54. 根元素字体大小<br>
  55. 用它做为字号的单位比较合适
  56. </div>
  57. </p>
  58. </body>
  59. </html>

效果图:
演示

Correcting teacher:天蓬老师天蓬老师

Correction status:qualified

Teacher's comments:rem用在字号上比较多
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post