Jump to content

"z-index: -1" ...still shown in front?!?!


Edward

Recommended Posts

Hi,

 

Here is a simplified version of my code. I am trying to get the contents of the second cell to be placed behind (in terms of layers) the cell before it. It works fine on Safari on Mac, but not on IE on Windows. I was fiddling with the code recently and got it to work, but made further changes and now it's broken again and I can't figure out what I did to get it working. At the monent IE shows the correct positions, but it always displays the first cell at the back, instead of at the front. I tested it without any links to external CSS and there was no improvement so the problem must be in this code. Please can someone help?

 

<body>
<div style="width: 100%; margin: auto;">
	<table style="width: 1000px; margin: auto">
		<tr>
			<td style="width: 1000px; text-align: center; vertical-align: top">
			<div style="position: relative;"><img src="images/bg_grad.gif" style="width: 1000px; height: 400px; top: -200px;" alt="" /></div>
			</td>
		</tr>
		<tr>
			<td style="width: 1000px; height: 200px; text-align: left; vertical-align: top;">
				<div style="position: relative;"><img src="images/bg_grad.gif" style="position: absolute; z-index: -1; width: 1000px; height: 400px; top: -200px;" alt="" /></div>
			</td>
		</tr>
	</table>
</div>
</body>

Link to comment
Share on other sites

set the position of the first image to absolute as well.

 

I don't know if this will help though.

 

If you are doing this for SEO purposes, be careful, it has the potential of getting your site banned from search engine indexes.

Link to comment
Share on other sites

Unfortunately I can't set the first cell's position to absolute as on my actual site it won't just contain an image, it will contain text and variable length content, so it needs to be relative so the cell length expands to accommodate it. No, it's no for SEO purposes at all.

 

This is really frustrating as it's fine in Safari and the code seems logical to me. I thought it was quite a straight forward ting to do, are you saying I should perhaps avoid using z-index?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.