Note that there are some explanatory texts on larger screens.

plurals
  1. POImage DIV Covering Child DIV
    text
    copied!<p>I have a simple program that echoes images out to a page from a database. I want to have a child element, just a simple slightly transparent box shown on top of the images.</p> <p>I know child elements always has a higher z-index than it's parent but the image always covers over the box I want on top. When the page is loading I can see the box in the position I want but then when the images load and the box it disappears. </p> <p>Here is a jsFiddle: <a href="http://jsfiddle.net/EBvCZ/" rel="nofollow">http://jsfiddle.net/EBvCZ/</a></p> <h1>PHP</h1> <pre><code>echo '&lt;div id="wrapper"&gt;'; while ($data = mysql_fetch_array($query_run)) { echo '&lt;div id="picback"&gt;&lt;div id="centerpic"&gt;&lt;a href="image.php?photo_id='.$data['photo_id'].'" title="View Photo"&gt;&lt;'.'img src="resizeimage.php?photo_id='.$data['photo_id'].'"&gt;&lt;/a&gt;'; echo '&lt;br style="clear:both;" /&gt;'; echo '&lt;div id="titlepic"&gt;This is an image&lt;/div&gt;'; echo '&lt;/div&gt;&lt;/div&gt;'; } echo '&lt;/div&gt; </code></pre> <h1>CSS</h1> <pre><code>#wrapper { overflow:auto; width:1000px; height:1000px; margin: 20px auto; } #titlepic { background-color:rgba(0, 0, 0, 0.5); top:100px; width:200px; height:35px; position:relative; } #centerpic { position:relative; margin:auto; width: 200px; height: 150px; top:18.75px; overflow:hidden; } #picback { position:relative; margin:10px 23px; top:75px; float:left; width:250px; height:187.5px; overflow:hidden; } #picback:hover { background-color:rgb(190,190,190); -webkit-border-radius:0.4em; -webkit-transition: background-color 0.5s; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload