Blogger Information
Blog 6
fans 0
comment 0
visits 3454
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
属性值简写与相对单位
swx
Original
583 people have browsed it

实例演示盒模型属性简写的规则

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Title</title>
  6. <style>
  7. .box{
  8. width: 10em;
  9. height: 10em;
  10. padding: 1em 2em 1em 2em;
  11. border: 5px solid black;
  12. background: content-box royalblue;
  13. margin: 2em 5em 5em 2em;
  14. }
  15. </style>
  16. </head>
  17. <body>
  18. <div class="box">
  19. <p>内容文本</p>
  20. </div>
  21. </body>
  22. </html>

实例演示em与rem应用的场景,并分析区别与联系

em:子元素字体大小的em是相对于父元素字体大小。
rem:rem是全部的长度都相对于根元素。

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Title</title>
  6. <style>
  7. :root{
  8. font-size: 2em;
  9. }
  10. h1{
  11. font-size: 0.8rem;
  12. }
  13. p{
  14. font-size: 0.6rem;
  15. }
  16. </style>
  17. </head>
  18. <body>
  19. <h1>标题</h1>
  20. <p>内容文本</p>
  21. </body>
  22. </html>
Correcting teacher:天蓬老师天蓬老师

Correction status:qualified

Teacher's comments:简写是推荐的方式, 但可读性会有影响, 互有利弊吧
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