Blogger Information
Blog 19
fans 0
comment 0
visits 10715
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
CSS盒子模型
无名小辈
Original
352 people have browsed it

盒子有两种

1、块级:宽度总是占父级的全部宽度,高度由内容决定。可以自定义宽和高
2、内联级:高度是内容高度,宽度是内容宽度

  1. .box{
  2. width: 200px;
  3. height: 200px;
  4. border: 5px solid #232323;
  5. background-color: aqua;
  6. /* 裁切 */
  7. background-clip: content-box;
  8. margin: 20px;
  9. padding: 20px;
  10. /* 盒子计算方式,宽和高包含padding和border */
  11. box-sizing: border-box;
  12. /* 盒子计算方式,宽和高不包含padding和border */
  13. box-sizing: content-box;
  14. /* 简化方案:顺时针方向 */
  15. /* 上、右、下、左 */
  16. padding: 10px 20px 30px 40px;
  17. /* 上、左右、下 */
  18. padding: 10px 20px 30px;
  19. /* 上下、左右 */
  20. padding: 10px 20px;
  21. }
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