parent div witdh same like below image width

$(‘.blog-details-img’).each(function() {
$(this).width($(this).find(‘img’).width());
});

markup
<div style=”margin:0 auto;” class=”blog-details-img”>
<img src=”assets/img/blog-details-img.jpg” alt=””>
<div class=”text”>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Temporibus, necessitatibus nihil iure labore quo. Optio incidunt mollitia enim beatae vero.</p>
</div>
</div>

Leave a Reply

Your email address will not be published. Required fields are marked *