I find I like documenting IE bug fixes that I come across in my daily work. It is just as much for myself to go back to as it is for you the reader.
Well the other day I came across a real puzzling bug. Lets describe the circumstance first:
Lets say you have a table that lists of bunch of suppliers that a company has. It includes an image and the company name.
Something like the following:
<table id="suppliers">
<tr>
<td><img src="images/suppliers/airflex.jpg" alt="" /></td>
<td><img src="images/suppliers/wallace.jpg" alt="" /></td>
<td><img src="images/suppliers/lunde.jpg" alt="" /></td>
<td><img src="images/suppliers/hutchens.jpg" alt="" /></td>
</tr>
<tr>
<td>Airflex</td>
<td>Wallace Forge Company</td>
<td>Lunde Lift Systems</td>
<td>Hutchens Industries</td>
</tr>
</table>
Now let’s say that each image is a different size… and you want to control this. You use the following CSS rule:
table#suppliers img {
max-height: 107px;
max-width: 159px;
}
This now keeps the height and width reasonable. Now if you look in Firefox it looks great… IE8 has its table stretch out to the sides…. and IE7 looks perfect.
This had me stumped… why does IE8 show worse than IE7. It made no sense. Below is the solution I found.
The simple solution is to specify a direct width for the table, as well as set the table-layout to fixed:
table#suppliers {
table-layout: fixed;
width: 726px;
}
Happy Bug Fixing!
Find Out More Over at Bytes.com
Heya. Thanks for sharing your solution. I wouldn’t necessarily call this a bug though. I would say IE8 in this instance is just a bit more meticulous about what information you provide. Some browsers just need more information than others. Thanks again!
February 19th, 2010 at 10:07 am
Not a bug really? How about a fluid width table-cell then? May be you can write cryptic JS codes to “inform” ie8 that parent should resize to fit its inner contents. May be we can render all page with JS and “inform” ie8 just to show it. Bribed by MS or smt?
I was simply saying for a lot of scenarios people label bugs and create hacks for, it just takes a simple extra bit of information for the browser to render it perfectly.
Twitter
Follow me on Twitter to keep up to date!
RSS Feed
Keep up with all of our updates by subscribing to our RSS feed!
FaceBook
Join our group on Facebook and become a fan of us!