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
  • 97,368
  • 26
  • 197
  • 188
user3066588
  • 111
  • 1
  • 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
  • 22,070
  • 18
  • 81
  • 118