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.
I try solution, but it my table it didnt work ![]()
I have tables inside table, maybe that is reason why this hack doesnt work for me.
Nice post, fixes just the problem I was having with IE ignoring the width I was supplying for the table cell. Thanks for sharing.
September 12th, 2010 at 10:43 pm
Perfect Fix .
Thanx ![]()
Great post.
I have searched a lot for a fix to this bug.
Thanks.
Thank you so much!! I’ve tried everything and this works great!
February 20th, 2011 at 5:34 am
Many thanks. That helped me out a lot!
Thanks, works great!
September 28th, 2011 at 7:25 am
Thank you for the solution! It works great.
It was a big surprise that IE8 has so king of bug.
THANK YOU and the internet for this fix! I was googling this issue and found your site on my 1st round of searches. Your write up described my issue to a Tee! Popped in your suggested fix and whalah..cussing out IE8 stopped for the moment. Thanks again.
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!