位置:相对 [英] position: relative

查看:64
本文介绍了位置:相对的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据我关于CSS的书,如果你将''position:relative''应用于

块级元素,它将保持原样。但是,你可以用
然后使用top,left等来相对于它的位置偏移元素。


然而,查看其他人的样式表,我经常看到''位置:

相对''应用于元素,但没有使用顶部,左边等,

这让我想到使用''位置:亲戚''有一些其他的影响

我的书还没有说清楚。


例如,在这个网站的样式表中

http://www.blue-sky.co.uk/



http://www.blue-sky.co.uk/main.css


#navbar有''position:relative''但到底是什么? ''位置:

亲戚''对绝对定位的后代有影响

#navbar?


任何人都可以对此有所了解?

According to my book on CSS, if you apply ''position: relative'' to a
block-level element, it will stay exactly where it is. However, you can
then use top, left etc. to offset the element relative to its position.

However, looking at other people''s stylesheets, I often see ''position:
relative'' applied to elements but without the use of top, left etc.,
which makes me think using ''position: relative'' has some other effect
that my book has not made clear.

For example, in this site''s stylesheet

http://www.blue-sky.co.uk/

at

http://www.blue-sky.co.uk/main.css

#navbar has ''position: relative'' but to what end? Does ''position:
relative'' have a bearing on the absolutely positioned descendents of
#navbar?

Can anyone throw some light on this?

推荐答案

Mark写道:
Mark wrote:

根据我的书在CSS上,如果你将''position:relative''应用到

块级元素,它将保持在原来的位置。但是,你可以用
然后使用top,left等来相对于它的位置偏移元素。


然而,查看其他人的样式表,我经常看到''位置:

相对''应用于元素,但没有使用顶部,左边等,

这让我想到使用''位置:亲戚''有一些其他的影响

我的书还没有说清楚。


例如,在这个网站的样式表中

http://www.blue-sky.co.uk/



http://www.blue-sky.co.uk/main.css


#navbar有''position:relative''但到底是什么? ''位置:

亲戚''对绝对定位的后代有影响

#navbar?


任何人都可以对此有所了解?
According to my book on CSS, if you apply ''position: relative'' to a
block-level element, it will stay exactly where it is. However, you can
then use top, left etc. to offset the element relative to its position.

However, looking at other people''s stylesheets, I often see ''position:
relative'' applied to elements but without the use of top, left etc.,
which makes me think using ''position: relative'' has some other effect
that my book has not made clear.

For example, in this site''s stylesheet

http://www.blue-sky.co.uk/

at

http://www.blue-sky.co.uk/main.css

#navbar has ''position: relative'' but to what end? Does ''position:
relative'' have a bearing on the absolutely positioned descendents of
#navbar?

Can anyone throw some light on this?

http://www.quirksmode.org/ css / position.html

CSS测试 - 位置声明


-

小心,


Jonathan

-------------------

LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com


Mark写道:
Mark wrote:

>

然而,看着其他人的样式表,我经常看到''位置:

相对''应用于元素但没有使用顶部,左边等,

这让我觉得使用''position:relative''有其他一些影响

,我的书还没有说清楚。
>
However, looking at other people''s stylesheets, I often see ''position:
relative'' applied to elements but without the use of top, left etc.,
which makes me think using ''position: relative'' has some other effect
that my book has not made clear.

http://brainjar.com/css/定位/ default2.asp


通过后代定位阅读


-

Berg

http://brainjar.com/css/positioning/default2.asp

Read through Descendant Positioning

--
Berg


在8déc,11:51,Mark< u ... @ example.netwrote:
On 8 déc, 11:51, Mark <u...@example.netwrote:

依据在我关于CSS的书中,如果你将''position:relative''应用到

块级元素,它将保持原样。但是,你可以用
然后使用top,left等来相对于它的位置偏移元素。


然而,查看其他人的样式表,我经常看到''位置:

relative''应用于元素但没有使用top,left等,
According to my book on CSS, if you apply ''position: relative'' to a
block-level element, it will stay exactly where it is. However, you can
then use top, left etc. to offset the element relative to its position.

However, looking at other people''s stylesheets, I often see ''position:
relative'' applied to elements but without the use of top, left etc.,



你好马克,


然后左边的值是auto,最高值是auto。根据CSS 2.x


Hello Mark,

Then left value is auto and top value is auto. The initial and default
value of top, left, right and bottom is auto according to CSS 2.x


让我想到使用的顶部,左侧,右侧和底部的初始值和默认值> b $ b值是自动的。 ''position:relative''有一些其他的影响

我的书还没有说清楚。


例如,在这个网站的样式表<

http://www.blue-sky.co。




http://www.blue-sky.co.uk/main.css


#navbar有''位置:相对''但到底是什么? ''位置:

relative''对绝对定位的后代有影响

#navbar?
which makes me think using ''position: relative'' has some other effect
that my book has not made clear.

For example, in this site''s stylesheet

http://www.blue-sky.co.uk/

at

http://www.blue-sky.co.uk/main.css

#navbar has ''position: relative'' but to what end? Does ''position:
relative'' have a bearing on the absolutely positioned descendents of
#navbar?



是的应该。绝对。


您的网页还有很多其他问题。在MSIE 7下,文本大小可以不增加
。一些链接在蓝色背景上是蓝色的。您使用

136行检测来显示Flash,但是你低估了关闭Flash内容的人b
$ b。您的菜单还会在MSIE 7中触发脚本

错误和脚本调试器。部分原因是因为您在创建窗口时动态附加事件处理程序而不是

元素完全加载到body元素中。无论如何,为什么

动态地附加处理程序。为什么要使用嵌套的

列表的脚本呢?


* html #content {

margin:10px 0 0 225px;

}

会产生一个解析错误。

还有* _many_ *其他明显错误或不正确的内容

你的网页,特别是你的main.css
$ b $bGérard

Yes it should. Absolutely.

Your webpage has many other problems. Under MSIE 7, the text size can
not be increased. Some links are blue on a blue background. You use
136 lines of detection for displaying Flash but you underestimate
people who turn off Flash content. Your menu also triggers script
errors and script debugger in MSIE 7. In part this is because you
attach event handlers dynamically as the window is created and not as
the elements are completely loaded into the body element. Anyway, why
attach the handlers dynamically. Why resort to script for the nested
lists anyway?

*html #content {
margin: 10px 0 0 225px;
}
generates a parsing error.
There are *_many_* other things that are clearly wrong or incorrect in
your webpage, and in particular in your main.css

Gérard


这篇关于位置:相对的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆