Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

css

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

like image 234
ePezhman Avatar asked Jun 15 '13 14:06

ePezhman


2 Answers

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.

like image 108
Adam Simpson Avatar answered Nov 13 '22 16:11

Adam Simpson


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
like image 40
Mina Luke Avatar answered Nov 13 '22 15:11

Mina Luke