Safari Image Size

I am testing this issue in the latest version of Safari for Windows 7.

The problem is that this code works in all other browsers, but safari:

 <style type="text/css">
    .userImg { height: 100%; width: 100%; }
    .imgContainer { height: auto; width: 150px; }
 </style>

 <div class="imgContainer">
    <img id="img" class="userImg" src="TemplateFiles/Hydrangeas.jpg" alt="" />
 </div>

Does anyone know a trick to get this to proportionally distribute the image in Safari using only CSS?

Thank!

+3
source share
1 answer

Just set the image width only. The browser will scale the image proportionally automatically.

.userImg { width: 100%; }
.imgContainer { height: auto; width: 150px; }​
+6
source

All Articles