admin管理员组文章数量:1394143
I am creating a popover for a div using Twitter Bootstrap, but the text is too long and it seems to exceed the maximum width of the popover.
I want to show ... at the end of the text so I tried to style <li>
with text-overflow:ellipsis;
, but that didn't work.
javascript:
$(div).popover({
placement : 'right',
title : function (){
return '<span class="title">Title</span>';
},
content: function (){
return '<div class="body"><ul>'
+ '<li>This_is_a_long_long_long_long_long_long_long_long_long_long_long_long_long_text</li>'
+ '</ul></div>'
},
container : 'body',
html : 'true'
});
How can I wrap the text properly?
I am creating a popover for a div using Twitter Bootstrap, but the text is too long and it seems to exceed the maximum width of the popover.
I want to show ... at the end of the text so I tried to style <li>
with text-overflow:ellipsis;
, but that didn't work.
javascript:
$(div).popover({
placement : 'right',
title : function (){
return '<span class="title">Title</span>';
},
content: function (){
return '<div class="body"><ul>'
+ '<li>This_is_a_long_long_long_long_long_long_long_long_long_long_long_long_long_text</li>'
+ '</ul></div>'
},
container : 'body',
html : 'true'
});
How can I wrap the text properly?
Share Improve this question edited Dec 14, 2013 at 22:47 Mr Lister 46.6k15 gold badges113 silver badges155 bronze badges asked Dec 13, 2013 at 21:35 user959974user959974 3792 gold badges9 silver badges25 bronze badges 2- Add overflow:hidden to the popover class? – jraede Commented Dec 13, 2013 at 21:37
- Using Bootstrap 2 or 3? – Andrew Commented Dec 13, 2013 at 21:44
2 Answers
Reset to default 3http://jsfiddle/isherwood/W6a3B
.popover-content, .popover-content .body {
width: 100%;
}
.popover-content li {
overflow: hidden;
text-overflow: ellipsis;
}
My text on the page had the '...' and I wanted the popover to show the full text (which seems more useful than truncating the popover). To do that just override the popover-content style:
.popover-content {
word-break: break-all;
}
本文标签: javascriptText too long for Bootstrap PopoverStack Overflow
版权声明:本文标题:javascript - Text too long for Bootstrap Popover - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744662964a2618358.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论