Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Setting Bootstrap 4 Tooltip's Container</title> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js"></script> <style> .bs-example{ margin: 100px 50px; } .bs-example a{ margin: 25px; font-size: 24px; } </style> <script> $(document).ready(function(){ // Append tooltip HTML to wrapper element $("#myTooltips a").tooltip({ container: ".wrapper" }); }); </script> </head> <body> <div class="bs-example"> <div class="wrapper"> <div id="myTooltips"> <a href="#" data-toggle="tooltip" title="Edit Document"><i class="fa fa-edit"></i></a> <a href="#" data-toggle="tooltip" title="Save Document"><i class="fa fa-save"></i></a> <a href="#" data-toggle="tooltip" title="Download Document"><i class="fa fa-download"></i></a> <a href="#" data-toggle="tooltip" title="Print Document"><i class="fa fa-print"></i></a> <a href="#" data-toggle="tooltip" title="Delete Document"><i class="fa fa-trash"></i></a> <a href="#" data-toggle="tooltip" title="Settings"><i class="fa fa-cog"></i></a> </div> <!--Dynamically generated tooltip HTML code will be inserted here--> </div> <p><strong>Note:</strong> In this example dynamically generated tooltip HTML code will be inserted at the end of the ".wrapper" div instead of the body element.</p> </div> </body> </html>