当前位置: 首页 > 网络学院 > 网页制作基础教程 > CSS > CSS position属性
The position property places an element in a static, relative, absolute or fixed position.
position属性可将元素以static(静态),relative(相对),absolute(绝对)或是fixed(固定)的方式来安置
Inherited: No
继承性:无
h1 { position:absolute; left:100px; top:150px; } |
Value | 描述 |
---|---|
static | The element is placed in a normal position (according to the normal flow). With the value of "static" we do not use the "left" and "top" properties 元素以正常的形式形式来安置(以正常下垂的形式)。使用了static值我们就无法使用"left"以及"top"属性 |
relative | Moves an element relative to its normal position, so "left:20" adds 20 pixels to the element's LEFT position 相对元素原本的位置来对它进行移动,因此"left:20"就会将元素的左定位增加20象素距。 |
absolute | With a value of "absolute" the element can be placed anywhere on a page. The element's position is specified with the "left", "top", "right", and "bottom" properties 使用"absolute"值可以让元素放到页面的任何一个位置。元素的定位完全依赖"left","top","right"以及"bottom"的指定。 |
fixed |