首页 > Web开发 > 详细

CSS 中 Position relative 和 absolute区别

时间:2015-05-13 21:31:14      阅读:290      评论:0      收藏:0      [点我收藏+]

Relative Positioning

A relative positioned element is positioned relative to its normal position.
 
The reserved space for the element is still preserved in the normal flow.
 
relative 位置是相对元素的父元素的位置。left, top 是相对其父元素进行调整, 但是位置还是和DOM中的看起来一致(in normal flow)。
 

Absolute Positioning

An absolute position element is positioned relative to the first parent element that has a position other than static

Absolutely positioned elements are removed from the normal flow.

absolute 位置是相对第一个具有position(fixed, relative, absolute) 属性的父元素位置, 实际位置可能和DOM中的不一致(be removed from the normal flow)。

CSS 中 Position relative 和 absolute区别

原文:http://www.cnblogs.com/happylong/p/4501387.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!