When you have a stretchable layout, however, that doesn't work. And what you need to do is use CSS, "display: inline-block" The problem is, it doesn't have consistent support across browsers. Only Opera and Safari use "display: inline-block" and "display: inline-table" correctly. IE6 and Firefox both use "display: inline" only and don't recognize inline-table and inline-block.
So thank goodness for design blogs out there: Align List Items Horizontally with CSS . His solution is a bit of a work around, but it prevents me from writing any javascript when I didn't need to.
.ib-fix li { display:-moz-inline-box; -moz-box-orient:vertical;
display:inline-block; vertical-align:top; word-wrap:break-word; }
* html .ib-fix li { display:inline; }
* + html .ib-fix li { display:inline; }
.ib-fix li > * { display:table; table-layout:fixed; overflow:hidden; }
I should add that you need to also add this to get it to work in IE6, and get rid of the weird padding on the left:
ul.ib-fix
{
list-style: none inside none;
padding: 0px;
}
Yay. small tip! As a bonus, I also found out about ie7.js, a javascript library that fixes incompatibilities in ie7 and ie6.
You were mentioning IE7.js. Check out Mootools. It's a bit of a learning curve at first but it ends up making things a lot easier once you figure it out. I haven't had to think about browser compatibility at all since I got Mootools figured out.
ReplyDeleteWhen IE7 came out I pretty much gave up on AJAX as it had slight incompatibilites with both IE6 and Firefox giving me 3 branches of code for a request. Now I use a single line.
Actually, Firefox does render inline-block perfectly, no need for any hack.
ReplyDeleteThis may have been for FF2, when i wrote it.
ReplyDelete