possible to use <img> as <div>?

Posted by FatDogMark on Stack Overflow See other posts from Stack Overflow or by FatDogMark
Published on 2012-12-09T04:51:33Z Indexed on 2012/12/09 5:04 UTC
Read the original article Hit count: 75

Filed under:
|

for example if I want to put an image wrap another object,possible?

<img src='pic.png'>
<div id='block'>
<p>Somebody
</div>
</img>

I know I should just use div and background-image but I want to use the property auto

img{width:50%; height:auto;}

If I use div , using auto won't works because it won't know the background-image size and will not adjust the div depends on the image ratio aspect.

© Stack Overflow or respective owner

Related posts about html

Related posts about css