浮动

浮动的基本概念

image.png

浮动的使用

image.png
image.png

浮动的顺序贴靠特性

image.png

浮动的元素一定能设置宽高

image.png
image.png
image.png
不要节约盒子

右浮动

image.png

使用浮动实现网页布局

image.png

BFC规范和浏览器差异

image.png
image.pngimage.png

从一个现象说起

image.png
image.png

如何创建BFC

image.png

什么是overflow:hidden;

image.png
image.png

BFC的其他作用

image.png
image.png

浏览器差异

image.png

清除浮动

image.png

清除浮动方法1

image.png

  1. * {
  2. margin: 0;
  3. padding: 0;
  4. }
  5. div {
  6. overflow: hidden;
  7. margin-bottom: 10px;
  8. }
  9. p {
  10. float: left;
  11. width: 100px;
  12. height: 100px;
  13. background-color: orange;
  14. margin-right: 20px;
  15. }
  1. <div>
  2. <p></p>
  3. <p></p>
  4. </div>
  5. <div>
  6. <p></p>
  7. <p></p>
  8. </div>

清除浮动方法2

image.png

清除浮动方法3

image.png

清除浮动方法4

image.png

定位

相对定位

image.png

位置描述词

image.png

相对定位的性质

image.png

相对定位的用途

image.png

绝对定位

image.png

  1. .box {
  2. position: absolute;
  3. bottom: 300px;
  4. right: 200px;
  5. width: 200px;
  6. height: 200px;
  7. background-color: orange;
  8. }
  1. <div class="box"></div>

位置描述词

image.png

绝对定位脱离标准文档流

image.png
image.png

绝对定位的参考盒子

image.png
image.png
image.png

绝对定位的盒子垂直居中

image.png

堆叠顺序z-index属性

image.png
image.png
image.png

绝对定位的用途

image.png
image.png

固定定位

image.png

固定定位注意事项

image.png