2013-06-15 14 views
6

Sto usando Twitter bootstrap nel mio sito e sto avendo span che può contenere parole lunghe e ho bisogno di romperlo. Io uso questo Css ma non funziona? qual è il problema?come rompere parola lunga in Span? (Utilizzando Twitter Bootstrap)

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

enter image description here

+0

possibile duplicato http://stackoverflow.com/questions/320184/how-to-prevent-l ong-words-from-breaking-my-div – Liam

risposta

24

È necessario aggiungere questo alla tua CSS per quel lasso

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; 
} 

Vedi this article per una spiegazione.

+0

Dovresti o sillabare correttamente le parole, o interrompere le stringhe arbitrariamente se hai un contenuto speciale per il quale è appropriato. Fare entrambi sullo stesso contenuto è sbagliato. –

+0

Jukka, se leggi l'articolo a cui ti ho collegato, hai bisogno di tutte quelle proprietà CSS per il miglior supporto del browser. –

+0

@AdamSimpson grazie a questo ho risolto il mio enorme problema –

2

Le domande dichiarato questo:

(usando Twitter Bootstrap)

così la correzione di bootstrap è questo: @include hyphens; questo bootstrap fuori dalla scatola mixin aggiungerà word-wrap: break-word; questo mixin è esiste sotto questo percorso:

/bootstrap-sass/assets/stylesheets/bootstrap/mixins/_vendor-prefixes.scss