Resize Image HTML

I want to resize the image in the vc_preview class according to the size of the Div above.So I want to resize the photo by fitting it into the div.

@foreach (var item in Model.productDatas)
{
    <div class="portfolio-item All col-md-4" style="width:...; height:..;">
        <div class="vc_anim vc_anim-slide">
            <section class="base contain">
                <a href="/Products/Product" class="vc_preview"> <img alt="example image" src='@Url.Content("http://...m" + item.Product_Image)' /> </a>
            </section>
            <div class="vc_hover">
                <div class="hover-wrapper">
                    <div class="text-wrapper">
                        <h4> @item.Product_Name </h4>
                    </div>
                    <div class="icon-wrapper">
                        <ul>
                            <li class="vc_icon"> <a href="/ProductDet/Index/[email protected]"> <i class="fa fa-link"> </i> </a> </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
}

Upvotes: 2

Views: 74

Answers (1)

arpit dhamija
arpit dhamija

Reputation: 11

Use this CSS styling

img{ width: 100%; height: 100%; object-fit: cover; }

Upvotes: 1

Related Questions