其实前面的标准流和浮动流都很理解,就是定位不太好理解,特别是相对定位和绝对定位,很多刚开始学的同学不好区分。因此这里,小强老师和大家一起分享CSS定位的学习。通过我们前面的学习,我们网页布局方法:1.标准流(最稳定)2.浮动流(float其次)3.定位流(稳定性最后)定位是完全脱离标准流的一种布局方式。其实前面的标准流和浮动流都很理解,就是定位不太好理解,特别是相对定位和绝对定位,很多刚开始学的同学不好区分。因此这里,小强老师和大家一起分享CSS定位的学习。我们知道,定位都是和方位名词一起使用的,调整位置,大部分使用top,left,bottom,right配合使用的。首先我们看看定位的分类:
position:absolute;绝对定位和相对定位用的相对来说,是比较多的地方。绝对定位到底有什么特点,在这里小强老师,给大家总结一下。
那么这个盒子,加上绝对定位后,都是以浏览器的左上角为原点,所有的移动,也是以该原点来移动的。案例如图:预览后
预览后
如图:生成效果:PRUWKzBiBQbwIMBgsDMIjJlYLkGQQICEJ9IJeW+puEEjQ+6Gf7j59+jmn+9GRdPfh+f3q+gBSv5zu69zX1ec53a3In/3fzxAS148aopU/fO9HDVHxLUH2iL1u0Yp8+Rs/QkhclX+x7d/9l/9V+RfbxLcE2SP2ukUrchcAAMCEyG0AAAATIkkAAAATaA4AADBD0xyJRGJ6enp0dHRoaGhwcLC/v7+/v39gYHBoaGh0dHR6ejqRSKz8hgIAQJmQd54jkUjcGhsbGBgYGhqemJiYmZmJx+Ppy8Xj8ZmZmYmJiaGh4YGBgVu3biUSCaklNgAAECR3zDE2NjY4ODg6eivbFl7E44mxsbGBgYGxsbFlLDUAAChLIslkMhaLDQ8PDw+PFO0MJ/F4fHh4ZHh4OBaLLdvmAQBA2RGJxWIDAwO3bo3NzsYThsTj8bGxsYHBweOftp1s/Q1CCCEbFLl58+bExESQ8pmcnBwfH79z584CAABYQGRJzlUkEolYLHb//v0UAAA87ERMV6i03Lt3b3o6Fo/HpR8OAAAsOyU1x8DgjcEbN30ukD7smJycunfvnvQjAgCA5aV4c1y5cvVM62dnWj+7fr3f52K3b9+enY3Pzs563dPt27e7u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