11

I'm using Twitter bootstrap in my site and I'm having span which may contain long word and I need to break it. I use this Css but not working? what's problem?

.fidDivComment {
    white-space: pre-wrap;
    display: inline-block;
}

enter image description here

ePezhman
  • 4,010
  • 7
  • 44
  • 80
  • possible duplicate http://stackoverflow.com/questions/320184/how-to-prevent-long-words-from-breaking-my-div – Liam Jun 15 '13 at 14:50

2 Answers2

31

You need to add this to your CSS for that span

span {
  -ms-word-break: break-all;
  word-break: break-all;

  /* Non standard for webkit */
  word-break: break-word;

  -webkit-hyphens: auto;
  -moz-hyphens: auto;
  hyphens: auto;
}

See this article for an explanation.

alex
  • 479,566
  • 201
  • 878
  • 984
Adam Simpson
  • 3,591
  • 2
  • 22
  • 27
4

The questions stated this:

(using Twitter Bootstrap)

so the bootstrap fix is this: @include hyphens; this bootstrap out of the box mixin will add word-wrap: break-word; this mixin is exist under this path:

/bootstrap-sass/assets/stylesheets/bootstrap/mixins/_vendor-prefixes.scss
Mina Luke
  • 2,056
  • 1
  • 20
  • 22