- this script is needed before the close the <body> tag
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
- you also need to the following script before the close the <body> tag
<!-- initiating the tooltip -->
<script>
document.addEventListener('DOMContentLoaded', function () {
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]');
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl =>
new bootstrap.Tooltip(tooltipTriggerEl)
);
});
</script>
- tooltip code:
<span data-bs-toggle="tooltip" title="/tʀistɛs/"></span>
- the tooltip can be formatted with CSS:
<style>
.tooltip-inner {
background-color: #fff !important; /* white background */
color: #000 !important; /* black text */
font-size: 1.5rem; /* increase font size (adjust as needed) */
padding: 0.5rem 0.75rem; /* optional: adjust padding */
border: 1px solid rgba(0, 0, 0, 0.15); /* optional: add a subtle border */
}
</style>