Unable to resize image in html (cshtml asp.net mvc 4)

10,767

Why not use class or style?

<img src="" alt="" class="yourclass" />
<img src="" alt="" style="width: 150px; height: 150px;" />

Share:
10,767
Aleksei Chepovoi
Author by

Aleksei Chepovoi

Updated on June 05, 2022

Comments

  • Aleksei Chepovoi
    Aleksei Chepovoi almost 2 years

    Unable to resize image: when I change height attribute nothing happens (even if I remove it) but the image size only reacts when width changes (both width and height are changed). Here is the line (razor view, asp.net mvc 4, html5):

    <img width="150" height="150" src="@Url.Action("myAction", "myController")" />
    

    Questions:
    1) What can be the reason for such behavior?
    2) How to resize image so that it will not go out of a particular scope (e.g. width 150 and height 150). I have images of different sizes and I want them to be of identical size.

    Thanks.