|
Posted by Ben C on March 31, 2008, 4:56 pm
Please log in for more thread options > In article
> ilya2@rcn.com wrote:
>
>> I am making an HTML table. It has a lot of columns with fixed width
>> (55 pixels). If I view it on full-screen IE window, the table fits on
>> the screen and looks just as I want it to look. When I make the window
>> smaller than the table, I expect horizontal scroll bar to appear.
>> Instead each column shrinks; a cell which had:
>>
>> word1 word2
>> word3
>>
>> becomes:
>>
>> word1
>> word2
>> word3
>>
>> thus distorting the table and making it look ugly. Only when I make
>> the window so small that columns can not shrink any more (each is the
>> longest word wide), does horizontal scroll bar appear.
>>
>> How can I avoid this -- keep the columns same width regardless of
>> window size? I already tried giving the table a fixed width -- it does
>> not solve the problem, if anything makes it worse.
>
> If you fix width all the cells and all the same and in pixels, you do
> run into all sorts of problems; what would you want to happen, for
> example, if the user upped his text size, where is the text to go if it
> cannot fit?
Unless you use table-layout: fixed, it will fit, no matter how narrow
the cells are made.
> Everything depends on the details of your project, perhaps a url might
> help. But perhaps this will give you a thought to play with: Don't
> bother with giving the table itself a width, try min-width in em for
> either all the cells or selected cells (by classing them is most
> reliable). Choose a size to fit the point below which text will wrap to
> your displeasure:
>
> td {border: 1px solid; min-width: 20em;}
Width on table cells kind of means minimum width anyway.
[...]
> Or use a 55px wide clear gif and don't tell anyone.
I'm surprised setting a width on the whole table didn't work as intended
but then the OP is talking about IE where anything goes.
|