Reputation: 1
i want to resize my image that is inside div tag according to changing my div tags size automatically.how can i achieve using j query please help us NOTE image is inside div tag.
Upvotes: 0
Views: 202
Reputation: 470
Here is the code.
<div id="img_box">
<img src="path/to/horizontal_image.jpg" style="width: 100%" />
</div>
Also have a look at the link below.
http://www.webmasterworld.com/css/3828593.htm
http://www.codingforums.com/showthread.php?t=145288
Upvotes: 1
Reputation: 74738
with jQuery:
$('.divSelector').find('img').css({
'width': '100%',
'height': '100%'
});
Upvotes: 0
Reputation: 109
The answer is simple add width: 100% to style. Like so:
<img src='image_url.jpg' style='width: 100%' alt='image_name'/>
Upvotes: 2