4

Ok, this is for a survey where the div is the chart just like you see it on facebook.

Basically:

<div style='border:1px solid black;width:300px;'>    
<div style='width:100px;???'>This text is longer than the inner div tag.</div>
</div>

...but I want the text not to break and go directly through the div. Can somebody help me with this?

AndyG
  • 39,700
  • 8
  • 109
  • 143
faq
  • 2,965
  • 5
  • 27
  • 35

2 Answers2

8

You can use white-space: nowrap. Ensure your div and its relevant ancestors don't have overflow: hidden otherwise you won't see the text as it leaves the element.

jsFiddle.

alex
  • 479,566
  • 201
  • 878
  • 984
0

CSS

word-wrap:nowrap;

Causes the text not to wrap. See word-wrap on MDN for more information.

0b10011
  • 18,397
  • 4
  • 65
  • 86