set the height and width of div element equal to img elemet's height and width?

Posted by Syom on Stack Overflow See other posts from Stack Overflow or by Syom
Published on 2010-06-12T09:28:37Z Indexed on 2010/06/12 9:32 UTC
Read the original article Hit count: 193

Filed under:
|

i have an img element

<img src="some.jpg" style="position:absolute;">

i don't know the height and width of the image, because it loads dinamicaly, but i need to create a div element with position absolute, which must have the same width and height than the image. i.e

   <div style="position:absolute;height:'img->height';width:'img->width'">

is it possible to do with just css? if no, maybe jquery?

Thanks

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about css