z指数问题 [英] z-index problem

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

问题描述

你好,

我有z-index的问题。

当我设置值时,它没有将对象移动到背景为我

想要它。


网站是这样的(这里简化了)


< body>

< div class =" one">

< img src =" ./ 1.gif" />

< / div>


< div class =" two">

< table class =" content">

.....

< / table>

< / div>

< / body>

而css是这样的:


body {

background-image :url(./ bg.gif);

}


..one {

position:absolute;

剩余:0px;

顶部:214px;

z-index:1;

}


..两个{

z-index:100;

}


..content {

背景颜色:#fff;

}

我只是遇到了这个总是在前面的图像的问题,但是

i希望它能在桌子后面,这就是为什么我在桌子上添加另一个div

的原因,但它也没有帮助。

是否有位置:绝对?或者它打破appart,

,因为我在桌子上有更多的元素?


我之所以想要这样的话就是这样,那就是背景图片是

a模式,但这一张图片应该只在那里一次,而不是多次

次。


任何人都知道哪里我在这里做错了什么?

hello there,
i''m having a problem with the z-index.
when i set the value it''s not moving the object into the background as i
want it.

the site is something like this (this here is simplified)

<body>
<div class="one">
<img src="./1.gif" />
</div>

<div class="two">
<table class="content">
.....
</table>
</div>
</body>
while the css is like this:

body {
background-image: url(./bg.gif);
}

..one {
position: absolute;
left:0px;
top:214px;
z-index:1;
}

..two {
z-index:100;
}

..content {
background-color:#fff;
}
I''m having only trouble with this one image that''s always in front, but
i want it to be behind the table, that''s why i added another div around
the table, but it didn''t help either.
Does it have todo with the position:absolute? Or is it breaking appart,
as i have more elements in the table?

The reason why i want todo it like this is, that the background image is
a pattern, but this one image should only be once in there, not multiple
times.

Anyone an idea where i''m doing something wrong here?

推荐答案

* Oliver *< ol ********** @ web.de> ;:
*Oliver* <ol**********@web.de>:

< body>
< div class =" one">< img src =" ./ 1.gif" />< / DIV>


为什么''div''?

< div class =" two">< table class =" content"> .....< /表>< / DIV>


为什么''div''?

< / body>

body {background-image:url(。 /bg.gif);}
.one {
位置:绝对;
顶部:214px;
z-index:1;
}
。两个{z-index:100;}


" .two"没有定位(''静态''),因此''z-index''不适用。

.content {background-color:#fff;}

我之所以想要这样做是因为背景图像是一个模式,但是这一个图像应该只存在一次,而不是多次

<body>
<div class="one"><img src="./1.gif" /></div>
Why the ''div''?
<div class="two"><table class="content">.....</table></div>
Why the ''div''?
</body>

body {background-image: url(./bg.gif);}
.one {
position: absolute;
top:214px;
z-index:1;
}
.two {z-index:100;}
".two" is not positioned (''static''), thus ''z-index'' does not apply.
.content {background-color:#fff;}

The reason why i want todo it like this is, that the background image is
a pattern, but this one image should only be once in there, not multiple
times.




为什么不把它放到''表''的''背景''那么?相应地设置

''background-position''和''background-repeat''。这将是

导致类似


< body>< table class =" content"> .....< / table> ;< / body>


body {background-image:url(./ bg.gif)}

.content {background:white url(。 /1.gif)0 214px no-repeat}


-

最好知道一些问题,而不是所有答案。

James Thurber



Why don''t you put it into ''background'' of the ''table'' then? Set
''background-position'' and ''background-repeat'' accordingly. That would
result in something like

<body><table class="content">.....</table></body>

body {background-image: url(./bg.gif)}
.content {background: white url(./1.gif) 0 214px no-repeat}

--
"It is better to know some of the questions than all of the answers."
James Thurber


Christoph Paeper< ch ************** @ nurfuerspam.de> ;写道:
Christoph Paeper <ch**************@nurfuerspam.de> wrote:
* Oliver *< ol ********** @ web.de>:
*Oliver* <ol**********@web.de>:

< body>
< div class =" one">< img src =" ./ 1.gif" />< / div>
为什么''div''?

<body>
<div class="one"><img src="./1.gif" /></div>
Why the ''div''?




如果他正在使用Strict,IMG *有*到在一个街区。您不能直接在身体内部使用

内联元素。



If he''s using Strict, the IMG *has* to be in a block. You can''t have
inline elements directly inside the body.

< div class =" two">< table class =" ; content"> .....< / table>< / div>
<div class="two"><table class="content">.....</table></div>



为什么''div''?



Why the ''div''?




对,对于有效性不是必需的。

-

Harlan Messinger

从我的电子邮件中删除第一个点地址。

Veuillez?ter le premier point de mon adresse de courriel。



Right, not necessary for validity.
--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ?ter le premier point de mon adresse de courriel.


Christoph Paeper schrieb:
Christoph Paeper schrieb:
* Oliver *< ol ********** @ web.de>:
*Oliver* <ol**********@web.de>:

< body>
< div class = 一个>< img src =" ./ 1.gif" />< / div>

为什么''div''?

<body>
<div class="one"><img src="./1.gif" /></div>

Why the ''div''?




如其他成员所说,我是using strict



As said by other member, i''m using strict

< div class =" two">< table class =" content"> .....< / table>< / div>

为什么''div'?
<div class="two"><table class="content">.....</table></div>

Why the ''div''?




仅用于测试目的。我说我先没试过就试过它。

想想也许它有帮助



Just for testing purposes. I said i tried it first without it and
thought maybe it helps

< / body>

body {background-image:url( ./bg.gif);}
.one {
位置:绝对;
顶部:214px;
z-index:1;
}
.two {z-index:100;}

" .two"没有定位(''静态''),因此''z-index''不适用。
</body>

body {background-image: url(./bg.gif);}
.one {
position: absolute;
top:214px;
z-index:1;
}
.two {z-index:100;}

".two" is not positioned (''static''), thus ''z-index'' does not apply.




position:static;没有帮助,改变了什么



position:static; didn''t help, change anything

.content {background-color:#fff;}

我之所以想要这样做是因为背景图片
是一个图案,但是这一张图片应该只在那里一次,而不是多次。
.content {background-color:#fff;}

The reason why i want todo it like this is, that the background image
is a pattern, but this one image should only be once in there, not
multiple times.



为什么你不放它进入''表'的''背景''然后呢?相应地设置
''background-position''和''background-repeat''。这将导致类似

< body>< table class =" content"> .....< / table>< / body>

body {background-image:url(./ bg.gif)}
.content {background:white url(./ 1.gif)0 214px no-repeat}


Why don''t you put it into ''background'' of the ''table'' then? Set
''background-position'' and ''background-repeat'' accordingly. That would
result in something like

<body><table class="content">.....</table></body>

body {background-image: url(./bg.gif)}
.content {background: white url(./1.gif) 0 214px no-repeat}




因为表格比图像出现的位置要小。

图像应始终位于屏幕的最左侧,而

表格以屏幕为中心。因此,我无法将该图像放入桌子的背景中。

无论如何,你还有另一个想法吗?



Because the table is samller than where the image should appear.
The image should always be on the very left of the screen, while the
table is centered to the screen. Thus i can''t put that image into the
background of the table.
Thanks anyhow, u have another idea?


这篇关于z指数问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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