展会信息港展会大全

CSS2.0  position属性
来源:互联网   发布日期:2016-03-25 16:35:31   浏览:2486次  

导读:position属性可将元素以static(静态)、relative(相对)、absolute(绝对)、fixed(固定)的方式来安置。position属性无继承性。PossibleVal...

position属性可将元素以static(静态)、relative(相对)、absolute(绝对)、fixed(固定)的方式来安置。position属性无继承性。Possible Values 可能用到的值staticThe 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方式是并不好用的方式,搞不好就会把网页搞乱。absoluteWith 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地定位是不可以的。

赞助本站

人工智能实验室

相关热词: 开发 编程 android

AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港