Search code examples
cssword-wrap

css word wrap with hyphens


I have a line of text in a div that might look like the following:

A really long user defined team Name 1 (7-0)

Where 7-0 would be the team record. This is in a div of a specific width and sometimes the browser likes to break on the hyphen which is unwanted because it should be treated the same as a word. So I might end up with:

A really long user defined team Name 1 (7
-0)

Is there a way to get word wrap working where it treats the hyphen as if it were a normal character and not a place that should support a break?


Solution

  • http://jsfiddle.net/zfsYK/4/

    here you go..

    I just wrapped the text that you do not want to break in a div set to display:inline..

    can't seem to make it break now