I have a div container with specific width and height. I insert an image in this div using javascript. The CSS linked to the image class is
max-height: 100%;
max-width:100%;
So my image can take as much space as it can in the container and keep its ratio. Problem : when inserted, the image takes all space (width and height 100%) and its ratio is not preserved.
What's very curious is that when I inspect the image opening the console, if I uncheck the css property max-height:100% and then check it again, my image resize and keeps its ratio. The resize happens too when I push a button that change a value on the DOM at another place.
What can I do to force this CSS "refresh", using javascript maybe ?