Cod*_*ang 4 html css twitter-bootstrap
我有一个特殊的情况,如果我在工具提示中放了太长的文字,它会超过工具提示宽度,就像

我把它添加到了 .tool-inner
word-break: break-all;
Run Code Online (Sandbox Code Playgroud)
它在这种情况下工作正常.
我创建了一个jsfiddle来说明我的所作所为.
使用word-wrapcss属性而不是word-break.
自动换行属性允许长字能够被打破并换行到下一行.
/* Latest compiled and minified JavaScript included as External Resource */
$('#hoverme1, #hoverme2').tooltip();Run Code Online (Sandbox Code Playgroud)
/* Latest compiled and minified CSS included as External Resource*/
/* Optional theme */
@import url('//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css');
body {
margin: 10px;
}
.tooltip-inner{
color: red;
background-color: black;
word-wrap: break-word;
text-align: left;
white-space: pre-line;
}Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>
Tooltip example
<br><br><br><br><br><br><br>
<a href="#" id ="hoverme1" data-toggle="tooltip" title="vocabularyvocabularyvocabularyvocabularyvocabularyvocabulary">long vocabulary</a>
<br>
<a href="#" id ="hoverme2" data-toggle="tooltip" title="This is very long sentence, and this is very important!">Nomal sentence</a>Run Code Online (Sandbox Code Playgroud)