Jump to content

Div's & iFrames


Ari Ace

Recommended Posts

Hello folks. I've been searching for a solution to this problem I'm having and haven't found one so I'm hoping that anyone reading this might know what's up.I'm trying to put an iframe over an image that is within a div container but the only way this works is if the iframe position is absolute. Problem is, when the iframe is absolute it ignores the div completely although the code is within the div. Simple example below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><style type="text/css">#container{width: 966px; margin: 0 auto} </style></head><body><div id="container">  <img src="images/main_sv.jpg" alt="main_sv"/><iframe src="http://www.google.com/" name="main_frame" frameborder="0" allowtransparency="true" width="186" height="162" style="border:0;position:absolute;top:50px;left:0px;z-index:+1;"></iframe></div></body></html>

If I change the position to anything else the iframe is placed within the div but is also placed below the image instead of over it.If I increase "left" while in absolute position the iframe is moved over the image but is also fixed to the browser instead of the div.

Link to comment
Share on other sites

do you need the + before the 1 when using z-index? Isn't it just a simple integer value (1, 2, 3, 4, etc).Yes, an absolutely positioned element will be taken out of the flow of the document, that's what they do, unless in a parent element of certain positioning.http://www.w3schools.com/Css/pr_class_position.asp

Link to comment
Share on other sites

Do you need the + before the 1 when using z-index? Isn't it just a simple integer value (1, 2, 3, 4, etc).Yes, an absolutely positioned element will be taken out of the flow of the document, that's what they do, unless in a parent element of certain positioning.http://www.w3schools.com/Css/pr_class_position.asp
Nope, not really. I'm just used to putting it there since you have to put a "-" on it when you move items to the back. Doesn't make a difference really.:) If anyone has ANY kind of idea of how to make this happen, please post. :)Edit: Never mind, I'll just use the image as a background and it'll work just fine that way. Anyway, this thread can now be closed.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...