查看: 727|回复: 7
|
关于css的问题(已解决)
[复制链接]
|
|
请问有哪位高手可以解释css里的 position: relative,absolute,和fixed这三者有什么差别?
先谢了!
[ 本帖最后由 bluezcheng 于 8-4-2007 12:47 AM 编辑 ] |
|
|
|
|
|
|
|
发表于 7-4-2007 11:52 AM
|
显示全部楼层
|
|
|
|
|
|
|

楼主 |
发表于 7-4-2007 05:07 PM
|
显示全部楼层
回复 #1 bluezcheng 的帖子
没有人可以解释一下吗?
目前我只试到absolute而已,这个可以控制网页里任何element的位置。
至于relative,和fixed我到现在都还搞不懂它们用来怎样控制的?另外还有一个叫做static的,更让我头痛 。。。
在w3schools找过相关资料,但看不是很明白,
Value Description
static= Default. An element with position: static always has the position the normal flow of the page gives it (a static element ignores any top, bottom, left, or right declarations)
relative= An element with position: relative moves an element relative to its normal position, so "left:20" adds 20 pixels to the element's LEFT position
absolute= An element with position: absolute is positioned at the specified coordinates relative to its containing block. The element's position is specified with the "left", "top", "right", and "bottom" properties
fixed= An element with position: fixed is positioned at the specified coordinates relative to the browser window. The element's position is specified with the "left", "top", "right", and "bottom" properties. The element remains at that position regardless of scrolling. Works in IE7 (strict mode)
也试过在try it yourself修改coding看看效果,也捉不到它们的分别以及到底是怎样用的?
希望这里的高手可以指点指点一下小弟,先谢谢了! |
|
|
|
|
|
|
|
发表于 7-4-2007 05:32 PM
|
显示全部楼层
|
|
|
|
|
|
|

楼主 |
发表于 7-4-2007 11:32 PM
|
显示全部楼层
回复 #4 yeephuang 的帖子
非常谢谢你给的参考!
现在都了解relative和static的作用了。
只是。。。可能小弟真的智质有限,还是捉不到fixed的用法。。。 |
|
|
|
|
|
|
|
发表于 8-4-2007 12:01 AM
|
显示全部楼层
|
|
|
|
|
|
|

楼主 |
发表于 8-4-2007 12:45 AM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 8-4-2007 10:33 AM
|
显示全部楼层
对不起,不是你的英文烂,而是我没注明清楚。
那个link的确没有关系到fixed,但有fixed的效果,
也就是右边那个post comments的东西,不管你如何上下scroll,它的位置都是fixed的。 |
|
|
|
|
|
|
| |
本周最热论坛帖子
|