How to change the width and height of Twitter Bootstrap’s tooltips?

Bootstrap tooltip: A Tooltip is used to provide interactive textual hints to the user about the element when the mouse pointer moves over. Standardized bootstrap element collection like a small pop-up which appears whenever user performs any specific action click, hover(default), and focus on that element. It also supports manual trigger for specific events.

In this article, we will design the tooltip first then we will manipulate the height and width of that tooltip.
Create tooltip: The data-toggle=”tooltip” attribute is used to create a tooltip. The title attribute is used to specify the text that should be displayed inside the tooltip.

Changing width/height of tooltip: Here, we will modify the .tooltip-inner class for satisfying that demand by over-riding the some of the default CSS properties. Below is the implementation for the same.



  • Program:
    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html> 
    <html lang="en"
    <head
        <title>Tooltip</title
          
        <meta charset="utf-8"
        <meta name="viewport" content="width=device-width, initial-scale=1"
      
        <link rel="stylesheet" href
          
        <script src
        </script
          
        <script src
        </script
          
        <script src
        </script
        <style>
            body {
                text-align:center;
            }
              
            h1 {
                color: green;
            }
            .tooltip-inner
                        {
                            width:200px;
                            height:100px; 
                            padding:4px;
                        }
        </style>
    </head
      
    <body
          
        <div class="container"
              
            <h1 data-toggle="tooltip" 
                title="A Computer Science Portal for Geeks"
                GeeksforGeeks 
            </h1
        </div
          
        <script
            $(document).ready(function() { 
                $('[data-toggle="tooltip"]').tooltip(); 
            }); 
        </script
    </body
      
    </html>                        

    chevron_right

    
    

  • Output:

full-stack-img




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.