Next generation's garbage RSS 2.0
# Friday, November 02, 2007

Yes, yes, I hear you anti-table zealots, but this is cool. (I'll have to blog my thoughts about this someday, along with the other religious argument about nothing but stored procedures accessible to code.)

Scenario: You have a table that will have n columns, where n is determined at run time and you want the columns to have equal width, for example, a table that is 100px wide with 4 columns should render 25px wide columns, 5 wide, 20px.

Why is this useful? SharePoint or ASP.NET SitePath menus.

Here's how:

table tr td { width:5%; }

When the table renders and sums up the 5%s and gets only 20 or 25% total, it scales that up to be 100% and the cell width percentage scales up with it.

see it at http://hafthor.com/equalwidthtables.html

I haven't tested this non-quirks mode, but it does work in FireFox and IE7.

[Edit 2007-11-04] I have tested this in xhtml strict mode (IE7 and FireFox) - it still works.

see it at http://hafthor.com/tricks.html

[Edit 2007-11-05] Dang. FireFox doesn't render this the way I wanted when in xhtml strict mode. The issue wasn't apparent until the overall width wasn't really wide. But, I tried those pages on iPhone Safari and they looked okay.

Friday, November 02, 2007 2:30:28 PM (US Mountain Standard Time, UTC-07:00)  #    Comments [0] -
HTML | SharePoint
Comments are closed.
Archive
<July 2010>
SunMonTueWedThuFriSat
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567
All Content © 2010, Hafthor Stefansson - Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way. - Sign In