HighDots Forums  

z-index problem

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss z-index problem in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Oliver
 
Posts: n/a

Default z-index problem - 12-05-2004 , 05:22 PM






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?

Reply With Quote
  #2  
Old   
Christoph Paeper
 
Posts: n/a

Default Re: z-index problem - 12-05-2004 , 06:42 PM






*Oliver* <oliver_summa (AT) web (DOT) de>:

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

Quote:
div class="two"><table class="content">.....</table></div
Why the 'div'?

Quote:
/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.

Quote:
.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.
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


Reply With Quote
  #3  
Old   
Harlan Messinger
 
Posts: n/a

Default Re: z-index problem - 12-05-2004 , 09:11 PM



Christoph Paeper <christoph.paeper (AT) nurfuerspam (DOT) de> wrote:

Quote:
*Oliver* <oliver_summa (AT) web (DOT) de>:


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

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

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

Why the 'div'?
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.


Reply With Quote
  #4  
Old   
Oliver
 
Posts: n/a

Default Re: z-index problem - 12-06-2004 , 05:07 AM



Christoph Paeper schrieb:
Quote:
*Oliver* <oliver_summa (AT) web (DOT) de>:


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


Why the 'div'?
As said by other member, i'm using strict
Quote:
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
Quote:
/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; didn't help, change anything

Quote:
.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.


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?


Reply With Quote
  #5  
Old   
Gus Richter
 
Posts: n/a

Default Re: z-index problem - 12-06-2004 , 03:53 PM



Oliver wrote:
Quote:
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?
You have a positioned image partially obscurred by an overlapping table
and the image is greater than the table itself. The position of the
image and that of the table are required to remain as is. The image is
required to extend into the table as a background image of the table.

The solution here is to keep the image which is partially hidden by the
table, use the same image as a background image in the table and
position this background image such that it seems that it is one image
extending into the table are. The idea is that if the background image
is moved outside of (beyond) the table border, that portion will not be
visible. Since the background image applied to the table is
background-attachment:scroll by default, the reference is to the top and
left edges of the table. So by applying negative values to
background-position for the background image of the table until it abuts
seamlessly with the other identical image will result in what seems to
be one complete image.
i.e. background: white url(./1.gif) no-repeat -??px -/+??px;

If the requirement is to have the image portion outside of table to also
be a background image, then place the table inside a div and apply the
image also as a background image to the div using the same declaration
as for the table but with different positive background-position values.
It may also be necessary to position the div itself depending on the
need. In anticipation of further difficulties, it may also be necessary
to place the table within another immediate div in order to position the
table.

The concept is simple - the solution and explanation longer than I
expected or I went into too much detail and hopefully did not confuse.

--
Gus


Reply With Quote
  #6  
Old   
Christoph Paeper
 
Posts: n/a

Default Re: z-index problem - 12-06-2004 , 05:54 PM



*Oliver* <oliver_summa (AT) web (DOT) de>:
Quote:
Christoph Paeper schrieb:

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

position:static; didn't help, change anything
Of course not, that is what it is already by default. I should have been
more verbose, probably.

Quote:
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,

Why don't you put it into 'background' of the 'table' then?

Because the table is samller than where the image should appear.
Well, 'background-position' accepts negative values, too, or maybe
"background-attachment: fixed" suits your need, elsewise you probably do
need that containing 'div' (in theory you could assign the images to
'html' and 'body' instead).

--
"Right way turning, Listen we are learning.
Head's full of noise, Chicken's got no choice.
Heads are rollin', Chicken blood is stolen.
The rest of the chicken wants a picke-nicken" Guano Apes - We use the Pain


Reply With Quote
  #7  
Old   
devniall@gmail.com
 
Posts: n/a

Default Re: z-index problem - 12-06-2004 , 11:47 PM



Oliver wrote:

Quote:
.two {z-index:100;}


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

position:static; didn't help, change anything

I think he may have meant to say "position: relative;" or "position:
absolute;".

--
niall



Reply With Quote
  #8  
Old   
devniall@gmail.com
 
Posts: n/a

Default Re: z-index problem - 12-06-2004 , 11:48 PM



Oliver wrote:

Quote:
.two {z-index:100;}


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

position:static; didn't help, change anything

I think he may have meant to say "position: relative;" or "position:
absolute;".

--
niall



Reply With Quote
  #9  
Old   
Paul
 
Posts: n/a

Default Re: z-index problem - 12-07-2004 , 04:36 PM



Oliver wrote:
<snip>
Quote:
position:static; didn't help, change anything

Evidently, since it's the default positioning! Try
position: relative


Reply With Quote
  #10  
Old   
Oliver
 
Posts: n/a

Default Re: z-index problem - 12-09-2004 , 02:25 AM



Gus Richter schrieb:
Quote:
Oliver wrote:

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?


You have a positioned image partially obscurred by an overlapping table
and the image is greater than the table itself. The position of the
image and that of the table are required to remain as is. The image is
required to extend into the table as a background image of the table.

The solution here is to keep the image which is partially hidden by the
table, use the same image as a background image in the table and
position this background image such that it seems that it is one image
extending into the table are. The idea is that if the background image
is moved outside of (beyond) the table border, that portion will not be
visible. Since the background image applied to the table is
background-attachment:scroll by default, the reference is to the top and
left edges of the table. So by applying negative values to
background-position for the background image of the table until it abuts
seamlessly with the other identical image will result in what seems to
be one complete image.
i.e. background: white url(./1.gif) no-repeat -??px -/+??px;

If the requirement is to have the image portion outside of table to also
be a background image, then place the table inside a div and apply the
image also as a background image to the div using the same declaration
as for the table but with different positive background-position values.
It may also be necessary to position the div itself depending on the
need. In anticipation of further difficulties, it may also be necessary
to place the table within another immediate div in order to position the
table.

The concept is simple - the solution and explanation longer than I
expected or I went into too much detail and hopefully did not confuse.

hey,
ok i did manage to get it right. i used a surroundig div tag for the
table and added a background with the gif and used background-position.
Thanks for your help


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.