Div, IFrame, Form: the CSS version of Scissor, Paper, Stone

This gives the situation where a layer (in a div tag) over the top of a dropdown box leaves half the select box visible through the layer. E.g.
The code for this follows:
<div style="position: relative;">
<form name="testForm" id="testForm">
<select name="test" id="test">
<option>Peekaboo!</option>
</select>
</form>
<div style="background: rgb(0, 102, 153); position: absolute;
left: 50px; top: 10px; width: 300px; height: 20px;
color: rgb(255, 255, 255); overflow: hidden;
clip: rect(auto, auto, auto, auto);">
I'd like to be on top
</div>
</div>
The solution I've found is that IFrames can be rendered on top of select tags. Not much use in itself, but ever since Internet Explorer 5.5 it's been possible to give IFrames a Z-Index and render layers on top of them. So in the rendering scheme of things:
- select beats div
- iframe beats select
- div beats select
Hence the 'Scissors, paper, stone' reference of the title. The order does seem somewhat circular
To solve the IE rendering problem we can insert an iframe between the div and the select with the same dimensions as the div tag over the top, as follows:
With the following HTML code
<div style="position: relative;">
<form name="testForm" id="testForm">
<select name="test" id="test">
<option>Peekaboo!</option>
</select>
</form>
<iframe style="position: absolute; left: 50px;
top: 10px; width: 300px; height: 20px; background: #069;
color: #fff; overflow: hidden; clip: auto;"></iframe>
<div style="position: absolute; left: 50px;
top: 10px; width: 300px; height: 20px; background: #069;
color: #fff; overflow: hidden; clip: auto;">
I'd like to be on top
</div>
</div>
Comments:
Hi
The power of CSS is amazing. I’ve seen a few sites like this one where i’ve been blown away by what you can do. Alot of DHTML and other funkiness can be avoided if your clever with your stylesheet.
I want to manage a stick up footer on the website for IE 5.0 +. with CSS As you can see 1 on bmw.co.uk
thanks
Imran


