Blogger Information
Blog 40
fans 0
comment 1
visits 24389
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
第7章 1217-细说em/rem/vh/vw与响应式布局,学习心得、笔记
努力工作--周工--Robin
Original
600 people have browsed it

今天所学心得、笔记

1、详细描述em,rem的原理与应用场景 ;

  1. <style>
  2. div {
  3. font-size: 30px;
  4. }
  5. div span:first-of-type {
  6. font-size: 1em;
  7. }
  8. div span:last-of-type {
  9. font-size: 1rem;
  10. }
  11. </style>
  12. <div>
  13. <span>em举例:www.php.cn</span><br> <!--字体大小30px-->
  14. <span>rem举例:www.php.cn</span> <!--字体大小16px-->
  15. </div>
  16. 1、em依照父元素(div)字体大小为1个单位,本示例中:1em = 30px;
  17. 2、rem依照根元素(html)字体大小为1个单位,本示例中:1em = 16px;
  18. 3、em主要用来设置padding、margin、line-height等属性;
  19. 4、rem主要用来设置font-szie;
  20. 5、vw的单位为视口宽度/100,在高度为1920的视口中,vh = 19.2px;
  21. 6、vh的单位为视口高度/100,在高度为1080的视口中,vh = 10.8px;

示例截图


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