网页布局笔记

css 存在三种定位机制:

1.标准文档流(normal flow):从上到下 从左到右 输出文档内容 由块级元素(独占一行)和行级元素组成

2.浮动(float)

3.绝对定位(absolute positioning)

自动居中一列布局

index1.html

横向两列布局

index2.html

绝对定位布局

float 会影响到后面一个元素

清除浮动方法:

1.clear:both;

2.100%;overflow:hidden;

3.加br (不建议使用)

3种定位形式:

1.静态定位(默认)static

2.相对定位 relative

3.绝对定位 absolute fixed

原文地址:https://www.cnblogs.com/ElvinLong/p/4028796.html