Alex Rivera | Logout

Div tag within img tag

Asked 2012-05-03T05:00:47.590
17

I need to add a text on each of the image and I have the image gallery constructed using img tags. Can't I append div tags under img tags. Similar to the one shown here :

<img id="img1" class="img1_1" src="hello1_1">
  <div class="textDesc">HELLO1_1</div>
</img>

Though the div is appended to img tag , but I cant see the text "HELLO1_1" on the image.

Please can anyone help me? If you need the source code I can share it with you.

Here is the link to test the scenario : http://jsfiddle.net/XUR5K/9/

Edit
Report

1 Answer

-4

Rules of good tone.

  1. Use null source in IMG tag.
  2. Use CSS content:"" for WebKit browsers.
  3. Insert element through JavaScript. Clear in HTML does not affect.

Also you can use pseudo elements.

Example: https://github.com/Alexei03a/canvas-img

answered 2012-12-13T11:51:27.600

Your Answer