Is this CSS for sizing an <img> to 100% height and maintaining the ratio reliable (cross-browser)?
#reel img
{
height: 100%;
width: auto;
}
It seems to work on what browsers I have, but I’m sceptical of the auto value.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Short answer: yes. That’s how you do it. Not sure what more to add. Edit: You could add
!importantto the auto-rule just in case theimghas an inlinewidthattribute. Edit2: Actually the!importantdoesn’t seem necessary: http://jsfiddle.net/Z7ME8/