The default tooltip template in Bootstrap is a black box with white text. However, it is possible to modify the .tooltip css class to have a white background instead:
.tooltip{position:absolute;display:none;color:#333;text-align:left;font-size:0.9em;width:250px;}
.tooltip.in{opacity:0.9;z-index:1030;height:auto;display:block}
.tooltip.top{margin-top:-10px;text-align:center}
.tooltip.top{margin-top:-10px;text-align:center}
.tooltip.right{margin-left:10px}
.tooltip.bottom{margin-top:10px;text-align:center}
.tooltip.left{margin-left:-10px;text-align:right; position: absolute}
.tooltip-inner{display:inline-block;padding:10px;color:#666;background-color:white}
.tooltip-arrow{position:absolute;width:10px;height:0;}
.tooltip.top .tooltip-arrow{bottom:-5px;left:50%;margin-left:-5px;border-top-color:white;border-width:5px 5px 0}
.tooltip.right .tooltip-arrow{top:50%;left:-5px;margin-top:-5px;border-right-color:white;border-width:5px 5px 5px 0}
.tooltip.left .tooltip-arrow{top:50%;right:-5px;margin-top:-5px;border-left-color:white;border-width:5px 0 5px 5px}
.tooltip.bottom .tooltip-arrow{top:-5px;left:50%;margin-left:-5px;border-bottom-color:white;border-width:0 5px 5px}
If I want to change the tooltip template dynamically in an Angular directive:
angular.module("app", []).directive("tooltip", function(){
return {
restrict: "A",
scope: {
title: "@",
template: "@"
},
link: function(scope, element){
$(element).tooltip({
title: scope.title,
placement: "right",
});
}
}
})
For example, red-tooltip or blue-tooltip can be used:
<div ng-app="app">
<a href="#" tooltip title="Title-1" template="red-tooltip">Title-1</a>
<a href="#" tooltip title="Title-2" template="blue-tooltip">Title-2</a>
</div>
However, applying different overridden tooltip css classes may not work as expected.