On my website, I would like to display images uploaded by the user in a new window with a specific size ( width: 600px ). The problem is that images can be large. Therefore, if they are larger than these 600px , I would like to resize them, keeping the aspect ratio.
I tried the max-width CSS property, but it does not work: the image size does not change.
Is there any way to solve this problem?
HTML
<div id="ImageContainerr"> <img src="DisplayImage.do?ad_id=${requestScope.advert.id}" class="Image" /> </div>
CSS
img.Image { max-width: 100%;} div#ImageContainer { width: 600px; }
I also tried setting max-width: 600px for the image, but it doesn't work. The image is transferred from the servlet (it is stored outside the Webapps Tomcat folder).
html css image image-resizing
user1315305 Jun 18 2018-12-18T00: 00Z
source share