RacecaR
RacecaR

Reputation: 2087

Table putting words with spaces on different lines

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?

Upvotes: 4

Views: 262

Answers (4)

Nivas
Nivas

Reputation: 18364

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)

Upvotes: -1

Šime Vidas
Šime Vidas

Reputation: 186083

td { white-space:nowrap; }

Upvotes: 0

Jey Balachandran
Jey Balachandran

Reputation: 3935

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

Upvotes: 1

Alec
Alec

Reputation: 9078

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

Upvotes: 1

Related Questions