3

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
  • 38,029
  • 8
  • 100
  • 134
faq
  • 2,735
  • 4
  • 25
  • 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
  • 460,746
  • 196
  • 858
  • 974
0

CSS

word-wrap:nowrap;

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

0b10011
  • 17,812
  • 3
  • 64
  • 82