Click here to Skip to main content
15,888,006 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am displaying an image on a MVC View using the Html helper
<%=Html.Image()%> which works. I need to size the image to fit within the div, but am unable to do so. Sizing the div has no affect on the image. There is an overload that takes the argument object htmlAttribute that I thought I could use, but I can't make that work either.
Does anyone know of a way to size an image that comes from the model?

Thanks,
Jim
Posted

1 solution

You probably have to use javascript to get the size of the div (assuming it has an ID assigned to it), and then you can scale the image to fit.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900