教程集 www.jiaochengji.com
教程集 >  CSS教程  >  经典实例  >  正文 CSS2.0  position属性

CSS2.0  position属性

发布时间:2023-05-10   编辑:jiaochengji.com
教程集为您提供CSS2.0  position属性等资源,欢迎您收藏本站,我们将为您提供最新的CSS2.0  position属性资源
position属性可将元素以static(静态)、relative(相对)、absolute(绝对)、fixed(固定)的方式来安置。
position属性无继承性。
Possible Values 可能用到的值
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象素距。
relative是相对定位,它的参照点是该元素本来应该在要位置。比如说网页上并排放A B C这三个元素,如果给B设的css style是position为relative,且给一个正的left值的话,那么B就可以显示在C的右边了。relative的这种定位比较怪,原来一直以为是相对别的什么东西定位的,昨天才知道是错的。由于“该元素本来应该在要位置”在设计网页的时侯不好琢磨,故relative方式是并不好用的方式,搞不好就会把网页搞乱。
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"的指定。
absolute是绝对定位,即当前元素的坐标是相对其上一级的左上角来表示的。这个上一级是整个page,或是嵌套在外层的一个DIV。而表格中的TD等元素不会成为上一层,也就是说想以当前单元格的左上角为参照,absolute地定位是不可以的。

您可能感兴趣的文章:
IE6下最大宽度最小宽度最大高度和最小高度
背景(Background)如何缩写?
Jquery 类网页微信二维码图块滚动效果具体实现
避免表格table被撑开变形的CSS
python面向对象编程详解
Highcharts属性中英文参照(简单示例)
CSS3下拉菜单控件的样例(使用Font Awesome字体图标)例子
利用CSS实现Family tree(族谱)效果
CSS3中利用Animation steps属性实现指针时钟效果
JS仿百度搜索自动提示框匹配查询的实现代码

[关闭]
~ ~