7.盒模型.css 641 B

12345678910111213141516171819202122232425262728
  1. * {
  2. margin: 0;
  3. padding: 0;
  4. }
  5. ul {
  6. display: flex;
  7. list-style: none;
  8. flex-wrap: wrap;
  9. }
  10. li {
  11. width: 20%;
  12. height: 100px;
  13. background: #f00;
  14. border: 1px solid #ff0;
  15. padding: 10px;
  16. margin: 10px;
  17. box-sizing: content-box;
  18. }
  19. /*
  20. 盒模型:
  21. (W3c万维网)标准盒模型:box-sizing:content-box
  22. 内容计算:content = width(height)
  23. 盒子的总宽度:content + padding + border +margin
  24. (IE盒模型)怪异盒模型:box-sizing:border-box;
  25. 内容计算:content = width(height) + padding + border
  26. 盒子的总宽度:content + margin
  27. */