Blogger Information
Blog 47
fans 1
comment 0
visits 40472
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
盒模型与媒体查询与属性em,rem用法
新手1314
Original
463 people have browsed it

1.盒模型

1.盒模型常用属性:

代码:

  1. 1.盒模型由四层组成:
  2. 外边距:margin 边框:border 内边距:padding 盒子宽高:widthheight
  3. 2.box-sizing: border-box;直接锁定所需长宽,不用再去计算内边距和边框大小。

实现:

2.媒体查询

代码:

  1. html:
  2. <button class="bt da">btn1</button>
  3. <button class="bt zhong">btn2</button>
  4. <button class="bt xiao">btn3</button>
  5. css:
  6. .bt.da {
  7. font-size: 12px;
  8. }
  9. .bt.zhong {
  10. font-size: 12px;
  11. }
  12. .bt.xiao {
  13. font-size: 12px;
  14. }
  15. @media (max-width: 374px) {
  16. html {
  17. font-size: 20px;
  18. }
  19. }
  20. @media (min-width: 376px) and (max-width: 400px) {
  21. html {
  22. font-size: 30px;
  23. }
  24. }

实现:


3.em与rem用法

  1. em:获取父元素的大小
  2. rem:获取html元素的大小

em实现:

rem实现:

Correcting teacher:PHPzPHPz

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