html - Bootstrap 工具提示换行和中断

标签 html css twitter-bootstrap

我有一个特殊的情况。如果我在工具提示中放置一个长文本,它会扩展并覆盖工具提示框架,就像这样。

enter image description here

在我将其添加到 .tool-inner 之后

word-break: break-all;

在这种情况下效果很好。

但是,它还是这样打破了正常的句子。

enter image description here

我创建了一个 jsfiddle来说明我做了什么。

最佳答案

使用 word-wrap css 属性代替 word-break

The word-wrap property allows long words to be able to be broken and wrap onto the next line.

/* Latest compiled and minified JavaScript included as External Resource */
$('#hoverme1, #hoverme2').tooltip();
/* 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;
}
<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>

关于html - Bootstrap 工具提示换行和中断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39830175/

相关文章:

javascript - 使用 Bootstrap 和 jQuery 无法很好地呈现多个分页器

html - 没有位置的重叠Divs的设置层次: absolute

javascript - curl :如何修复 "Please turn JavaScript on and reload the page"

javascript - 自定义中断词

javascript - 使用 Bootstrap 4 beta 进行表单验证

html - 带有居中 Logo 的多行导航栏

html - 悬停时的下拉菜单超出容器宽度

html - 我可以在 html 中使用 <ul> 和 <li> 以表格形式呈现吗?

html - 最大宽度单元格的表格单元格内跨度上的省略号

css - 使用注释和结构编译的 SCSS