views:

35

answers:

4

I am trying to make a table in HTML. When I resize the window down to be narrow and the window tries to squash everything to fit inside the window even though it's narrow, it puts the contents of a cell on different lines. I don't want this to happen. E.g.:

home    about    contact us

when you narrow down the browser window:

home    about    contact
                 us

This is really annoying. I have tried putting   instead of a space where the space is, but it didn't help. Does anyone know the solution?

+1  A: 

You can use   for this. That way the browser sees it as one word.

Alec
A: 

Try adding CSS attribute of white-space to the <td> elements of the table. In particular, <td style='white-space: no-wrap;'>

Jey Balachandran
A: 
td { white-space:nowrap; }
Šime Vidas
A: 

What do you expect?

Say the window becomes smaller so that the cell also becomes smaller than to fit contact us completely, then do you expect The "extra" content to be hidden? The size of the cell never become smaller than a fixed-minimum?

You need to use width ad height along with overflow (overflow). overflow:hidden will hide the content that is more than the width (provided a height is given)

Nivas
What I expect is irrelevant, there is only what it does and what I want it to do.
RacecaR
I think it is relevant. For a particular problem there can be multiple solutions depending on context. In this situation, when we are dealing with resize of a window, I would want a scroll bar to appear and the table not shrinking, and you might want the other way. For me it was not clear whether you want "us" in "contact us" to come to the next line, not wrap at all, or hide.
Nivas