笔记:css中的position定位

position的值可以是:static,relative,absolute,fixed。

默认值是 static。设置 left、top值无效。

relative是相对定位,可以设置left、top、bottom、right值,它设相对本来的位置偏移。

absolute是绝对定位,可以设置left、top、bottom、right值,默认是相对整个网页,如果它的父元素是relative定位,则会相对父元素定位。

fixed设置left、top、bottom、right值,会将元素固定在屏幕上的某个位置,无论屏幕怎么滚动,它都在那里。

原文地址:https://www.cnblogs.com/mafengzi/p/10513400.html