ePezhman ePezhman - 4 months ago 16
CSS Question

how to break long word in Span?(using Twitter Bootstrap)

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

Answer

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.

Comments