-1

I have an image with absolute position image inside div tag. What i want to resize the div tag according to image if i resize the browser. My code are here:-

CSS

#parent{
    width:225px;
    height:auto;
    position:relative;
    border:1px solid #000;
}

img{
    position:absolute;
}

HTML

<div id="parent">
    <img src="images/photo1.jpg" />
</div>

Actually div tag border doesn't containing an image which is absolute positioned. Please help.

Vipin
  • 153
  • 7
  • 21

1 Answers1

1

Your question is not well worded. But maybe you need something like this?:

#parent{
    width:100%;
    max-width:250px;
    height:auto;
    position:relative;
    border:1px solid #000;
}

img{
    max-width:100%;
}

are you sure you need it absolute?

b_uk_happy
  • 478
  • 4
  • 13