Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is it. Unlike the answer above, it will work in IE:</p> <pre><code>&lt;style type="text/css"&gt; .outerCont {height:auto;width:auto;position:relative;z-index:1;margin:0px auto;overflow:hidden;display:inline;float:left;} .outerCont img {height:auto;width:auto;position:relative;z-index:2;} .comment {height:auto;width:100%;display:block;font-family:Arial, Helvetica, sans-serif;text-align:center;padding:10px;0px;10px;0px;color:#FFF;position:absolute;z-index:3;bottom:0;/*also set your semi transparent black background-image here using the background-image property*/} &lt;/style&gt; </code></pre> <p>You would use it like this:</p> <pre><code>&lt;div class="outerCont"&gt; &lt;img src="flower.jpg" /&gt; &lt;!--Or where ever the image is located --&gt; &lt;div class="comment"&gt; &lt;p&gt;Hello&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>The only issue that comes with both the ways above (mine and the other dude's) is that you sacrifice centering the image. In order to center the image you would have to creative a JavaScript using jQuery and use the CSS property to change widths and heights according to there inner content. What you are asking is for us to 'Shrink Wrap' a div to its contents, which is only something you can do in 3 special cases. Floated objects, Inline or Inline-Block objects, and and Absolutely positioned objects. Both Floated and Absolute objects cannot be centered without the use of JavaScript, and Inline Block doesn't act correctly in IE, meaning you need to use display:inline; float:left; for it to work like inline-block. You could center the image with JavaScript, and that's it. I can provide that code, but only upon request.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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