As an alternative to styling .tooltip-inner in the stylesheet, you can add styles directly to the tooltip by modifying the tooltip template.
This is probably not a good idea in most cases, because you will apply styles directly to the element, but it is worth noting that this is possible for those few cases when this is the only option or for some reason is the best option.
$(selector).tooltip({ title: "Lorem ipsum ...", template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner" style="max-width: none;"></div></div>', });
Or, as an attribute:
<span data-toggle="tooltip" title="Lorem ipsum ..." data-template='<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner" style="max-width: none;"></div></div>' >Some abbreviation</span> $(function(){ $('[data-toggle="tooltip"]').tooltip(); });
template :
The basic HTML to use when creating the tooltip.
The title tooltip will be entered in .tooltip-inner .
.tooltip-arrow will become a tooltip arrow.
The outer shell element must have a .tooltip class.
Default:
'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
Alternatively, you can add your own class to the template and create your own class.
$(selector).tooltip({ title: "Lorem ipsum ...", template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner my-custom-tooltip"></div></div>', }); .my-custom-tooltip { max-width: none; }
Nate Aug 01 '16 at 2:04 on 2016-08-01 14:04
source share