Internet Explorer IMG Element & Empty Width/Height Attribute Error

Recently found an error, bug or omission within the Internet Explorer rendering engine which I haven’t personally encountered before. The error involves the familiar <img> element and the use of the width and height attributes.

The following <img> element definitions will render as expected within Mozilla and Opera:

  • <img src="/path/to/image.jpg" />
  • <img src="/path/to/image.jpg" width="" />
  • <img src="/path/to/image.jpg" height="" />
  • <img src="/path/to/image.jpg" width="" height="" />

When a web browser encounters an img element without width or height attributes, the browser is required to render the image in its default aspect ratio. When either of the width or height attributes are provided, the browser is required to resize the image when rendered to meet the requested size.

Unfortunately, when Internet Explorer encounters items two, three and four listed above an error occurs where the browser does not render the image at all. Instead of disregarding the img elements empty width and height attributes, it considers the empty value to equate to zero (0) and the image is rendered appropriately.

Related posts:

  1. Internet Explorer Popup Blockers
  2. Disable Option’s In A Select (Dropdown) Element
  3. ASP Error ‘ASP 0104: 80004005′
  4. ASP Error ’800a000d’
  5. ASP Error ’0×80004005′

About Al

My name is Alistair Lattimore, I'm in my very early 30's and live on the sunny Gold Coast in Australia. I married my high school sweet heart & we've been together for longer than I can remember. Claire and I started our family in September 2008 when Hugo was born and added a gorgeous little girl named Evie in May 2010. You can find me online in the typical hangouts, Google, Twitter & facebook. .
This entry was posted in Programming, Software. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>