Bootstrap 4 Tutorial

BS4 Introduction

How to use Bootstrap

BS4 Layout

BS4 Grid System

BS4 Typography

BS4 Colors

BS4 Table

BS4 Images

BS4 Jumbotron

BS4 Alerts

BS4 Buttons

BS4 Button Group

BS4 Badges

BS4 Progress Bar

BS4 Pagination

BS4 Breadcrumb

BS4 Card

BS4 Collapse

BS4 Nav Tabs Pills

BS4 Navbar

BS4 Tooltip

BS4 Carousel

BS4 Scrollspy

BS4 Forms

BS4 Form Validation

BS4 Form Custom

Page Stats

Visitor: 405

Bootstrap 4 Tooltip

Bootstrap Tooltip plugin is small pop-up box that appears when the user hover the mouse pointer over an element.

      Hover Me Again!
<button class="btn btn-success" data-toggle="tooltip" title="Hi! I am a Button">Hover Me</button>
<a data-toggle="tooltip" title="Hi, I am a anchor tag">Hover Me Again!</a>
  • Tooltips must be initialized with jQuery.
jQuery code to initialize ToolTip
<script>
$(document).ready(function(){
    $('[data-toggle="tooltip"]').tooltip(); 
});
</script>

Positioning Tooltips

By default, the tooltip will appear on top of the element. Use data-placement="left" attribute to set the position of the tooltip. Value can be top(default), bottom, left and right.

Left Tooltip       Right Tooltip       Bottom Tooltip       Top Tooltip
<a data-toggle="tooltip" data-placement="left" title="I will appear in left">Left Tooltip</a> 
<a data-toggle="tooltip" data-placement="right" title="I will appear in right">Right Tooltip</a> 
<a data-toggle="tooltip" data-placement="bottom" title="I will appear in bottom">Bottom Tooltip</a> 
<a data-toggle="tooltip" data-placement="top" title="I will appear in top">Top Tooltip</a>

Tooltip Options

Name Description
Delay Specifies the number of milliseconds it will take to show and hide the tooltip.
trigger Specifies how the tooltip is triggered.

Delay Syntax

$('.delay1').tooltip({title: "Tooltip with 1 Second delay", delay: 1000}); 
$('.delay2').tooltip({title: "Tooltip with hide/show", delay: {show: 1000, hide: 100}});

Trigger Syntax

$('.trigger1').tooltip({title: "Click Me!", trigger: "click"}); 
$('.trigger2').tooltip({title: "Hover Me!", trigger: "hover"}); 
$('.trigger3').tooltip({title: "Focus Me!", trigger: "focus"});
Updated: 7-Feb-21