Wednesday, April 25, 2007

[code] Keeping mininum table column width

Learned this trick from Dana today on how to have a table column stretch wider when one expands the browser, and yet maintain a minimum width (say, 500px) when shrinking the browser.

- Make the column stretchy, then stick this in the column:
<img class="MinWidthPix" src="/images/pix.gif">

- And stick this in the stylesheet
.MinWidthPix {width:500px;height:1px;}

- pix.gif is a 1x1 transparent gif

Dana also mentioned that, instead of a 1x1 pix, a HR tag could also work, but that the HR tag is prone to result in inconsistencies in different browsers.