Blogger Information
Blog 40
fans 0
comment 1
visits 24697
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
第8章 1218-盒模型与对齐方式,学习心得,笔记
努力工作--周工--Robin
Original
492 people have browsed it

今天所学心得、笔记

1、实例演示box-sizing属性;

  1. .box {
  2. width: 20em;
  3. height: 20em;
  4. /*padding部分颜色,不跟随背景颜色*/
  5. background: content-box;
  6. background-color: violet;
  7. border: solid 1px;
  8. padding: 10px;
  9. /*遵从 W3C 标准,宽高不包括border和padding值*/
  10. box-sizing: content-box;
  11. /*宽高包含border和padding值*/
  12. box-sizing: border-box;
  13. }

2、实例演示常用的元素居中方式;

  1. /*1. span 实现水平、垂直居中*/
  2. .box {
  3. width: 20em;
  4. height: 20em;
  5. border: solid 1px;
  6. /*span水平居中*/
  7. text-align: center;
  8. /*span垂直居中*/
  9. line-height: 20em;
  10. }
  11. /* 2. padding 实现DIV水平、垂直居中 */
  12. .box {
  13. width: 20em;
  14. padding: 5em;
  15. border: solid 1px;
  16. box-sizing: border-box;
  17. }
  18. .box>div {
  19. width: 10em;
  20. height: 10em;
  21. background-color: violet;
  22. }
  23. /* 3. margin 实现DIV水平、垂直居中 */
  24. .box {
  25. width: 20em;
  26. height: 20em;
  27. position: relative;
  28. }
  29. .box>div {
  30. position: absolute;
  31. top: 0;
  32. left: 0;
  33. right: 0;
  34. bottom: 0;
  35. margin: auto;
  36. }

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