0

How to put a "-" when the text is too small for a div box and should have a break line option.

Example:http://jsfiddle.net/2rqv6/

div id="box"> TExttexttexttext </div>

#box { border:1px solid #000;
   width:50px;
   height:auto;
   word-wrap: break-word;
}

I want the the text go on another line to put "-".

karthikr
  • 92,866
  • 25
  • 190
  • 186
user3066588
  • 111
  • 7

1 Answers1

0

Check out the CSS property "hyphens"

http://css-tricks.com/almanac/properties/h/hyphenate/

#box { border:1px solid #000;
       width:50px;
       height:auto;
       word-wrap: break-word;
       hyphens:auto;
}

Note you'll have to use -webkit, -moz, etc prefixs for respective cross browser compatibility

Sterling Archer
  • 21,348
  • 17
  • 79
  • 113