Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap tool tip - setting different widths for different tooltips

I am trying to set different widths for different tooltips. I have a tooltip on hyper link and a tooltip on h1 element. For hyperlink i have large text so I need the width of the tool tip to be large but for h1 element default width is fine.

When I am trying to overwrite the css as below all the tool tips are getting affected. Is there a way to give the width of a tooltip inline to the element on which the tooltip is applied

.tooltip-inner {
   max-width: 350px;
   width: 350px;
}

I tried to add two separate tooltip inner styles in the css as a.tooltip-inner and h1.tooltip-inner with different widths but its not taking effect

JSFiddle link http://jsfiddle.net/vinaybvk/qr1cbu92/

Is there any other way to achieve this.

Thanks.

like image 656
Vinay Avatar asked Aug 11 '14 15:08

Vinay


People also ask

How do I change font size in Bootstrap tooltip?

You can change the variable $ tooltip-inner-font-size and assign it a new value. You will find this variable in src/mdb/scss/free/_variables. scss . Remember that this will change the text size of all tooltips.

How do I change dynamic value tooltip?

Drag the calculated field to the appropriate tooltip and you'll see an ATTR dimension pill with a tooltip logo in the Marks card. Insert the ATTR budget and adjusted inflated gross calculated fields into its corresponding tooltip as seen in Image 6. After that, you're dynamic tooltip should work!


2 Answers

Give the container div a class:

<div class="large-tooltip">
    <i class="icon ion-help-circled" rel="tooltip" title="Hint"></i>
</div>

.large-tooltip .tooltip-inner {
    width: 250px;
}

In order to give different widths for tool-tips, rather than from adding different templates, it is possible to add different css classes for the container element and we can change the width of each element accordingly.

like image 148
sarathbabu Avatar answered Sep 16 '22 13:09

sarathbabu


(This Answer applies to BS 3.2) The only way I can think of achieving this is by overriding the default template for the tooltip. Then you use different selectors for large and regular tooltips like so;

DEMO

$('.tt_reg').tooltip();

$('.tt_large').tooltip({
    template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner large"></div></div>'
});

Note I've added the class large to the tooltip-inner element. You can then use css to adjust this size;

.large.tooltip-inner {
    width: 350px;
}
like image 37
Novocaine Avatar answered Sep 17 '22 13:09

Novocaine