Gradually shifting alignment of Bootstrap tooltips

I am encountering an issue with Bootstrap tooltips They seem to be progressively off-center Below is the code I am using for the icons

{{#each guilds}}
<div class="col-sm-1">
    <a href="/dash/{{this.id}}">
        <div class="gicon">
        {{#if this.icon}}
        <img src="https://cdn.discordapp.com/icons/{{this.id}}/{{this.icon}}" alt="{{this.name}}" class="rounded-circle mt-4" width="75" height="75" id="{{this.id}}"  data-toggle="tooltip" data-placement="bottom" title="{{this.name}}">
        {{else}}
        <img src="/public/images/default_guild.png" alt="{{this.name}}" class="rounded-circle mt-4" width="75" height="75" id="{{this.id}}"  data-toggle="tooltip" data-placement="bottom" title="{{this.name}}">
        {{/if}}
        </div>
    </a>
</div>
{{/each}}
.gicon {
    transition: ease-in-out 0.2s;
}

.gicon:hover {
    filter: brightness(80%);
}

Can anyone explain why this issue is occurring and offer a solution?

Answer №1

I have taken the liberty to code your example in jsfiddle. Feel free to visit this link and observe that the tooltips are perfectly centered. I trust that this explanation will be of assistance to you, serving as a clear guide for achieving centered tooltips.

The image has been stored in a folder named Images. It is located at the same level as the javascript code in the Scripts directory.

https://yourwebsite.com/kblau237/vx92pnec/3/

Javascript Code

@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index6</title>
    <style type="text/css">
        .gicon {
            transition: ease-in-out 0.2s;
        }

            .gicon:hover {
                filter: brightness(80%);
            }
    </style>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
    <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.7.6/handlebars.min.js"></script>

    <script type="text/javascript">
        //credit stack overflow
        $(function () {
            $("body").tooltip({ selector: '[data-toggle=tooltip]' });
            var an_array = [
                { id: 1, name: "Guild Name 1", imgURL: "https://file.coffee/u/R5wzGxVezHd.gif" },
                { id: 2, name: "Guild Name 2", imgURL: "https://file.coffee/u/R5wzGxVezHd.gif" }
            ];
            var source = $("#src").html();
            var template = Handlebars.compile(source);
            $("body").append(template({ guilds: an_array }));
        })
    </script>
</head>
<body>
    Tooltips are centered
    <script type='text/template' id='src'>
        {{#each guilds}}
        <div class="col-sm-1">
            <a href="/dash/{{this.id}}">
                <div class="gicon">
                    @*Changed the order of the images*@
                    {{#if this.icon}}
                    <img src="https://cdn.discordapp.com/icons/{{this.id}}/{{this.icon}}" alt="{{this.name}}" class="rounded-circle mt-4" width="75" height="75" id="{{this.id}}" data-toggle="tooltip" data-placement="bottom" title="{{this.name}}">
                    {{else}}
                    <img src="{{imgURL}}" alt="{{this.name}}" class="rounded-circle mt-4" width="75" height="75" id="{{this.id}}" data-toggle="tooltip" data-placement="bottom" title="{{this.name}}">
                    {{/if}}
                </div>
            </a>
        </div>
        {{/each}}
    </script>
</body>
</html>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Using Java beans to present form data utilizing session

How can I utilize Java Beans and session beans to store user input data and display a preview of the entered details on the next page? I have already created a servlet using JSP, but now I want to incorporate Java Beans to showcase the form data. How shoul ...

Input field, upon receiving focus, triggers a subtle shift in the position of the submit button

Thank you for the assistance, I believe this issue should be an easy fix. I have added a custom :focus style to my input that removes the default outline and adds a box shadow and border. However, when the input field is focused, the submit button located ...

Is it possible to create a button that can bring in a .css file?

Is there a way to create a button that imports styles from a .css file, or is it possible to change multiple CSS properties with buttons to create different website themes? This is the CSS file I have: .body { background-image: url("example.png"); } ...

How come the cubic bezier timing function works flawlessly just on the first try when staggered transitioning element opacity over time with CSS and a touch of JS?

I'm currently working on a menu overlay that expands to fill the screen when a user clicks a button in the corner. I'd like the menu items to fade in one by one, similar to the effect used on this website: Most of the functionality is there, but ...

What is the best way to use PHP to call an ACF variable and substitute a nested HTML element?

Utilizing the repeater field in Wordpress' advanced custom fields, I have made the content on my site dynamic. View an image of the static markup here The following is how I structured the content using plain HTML: <div class="container" ...

Include a proximity button onto the tabs

Currently, I'm diving into learning Bootstrap and one thing I'd like to implement is having an x next to each tab name for easy closing: <link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__ ...

Mobile Exclusive Bootstrap 5 Collapse Feature

Trying to implement the default collapse feature in Bootstrap 5x specifically for mobile devices. Despite setting up a CSS media query as per my research, the .collapse function doesn't seem to work as intended? The goal is to have the collapsed DIV ...

Obtain and utilize the background color to easily implement the same color in another window

For my Chrome Extension project, I am looking to retrieve the background color of the current page and then set the background color of a window to match. Can someone guide me on how to accomplish this using JavaScript (with or without jQuery), and if ne ...

Preserve the video's aspect ratio within a fixed height and width layout by utilizing CSS styling

I am currently in the process of developing a web application with a fixed height layout that does not utilize flexbox and is also limited by width constraints. My goal is to divide the screen in half both vertically and horizontally, around 50% for each ...

Acquire a set of picture cards for displaying in a grid layout

After creating a cardArray to store card objects, I went through each item in the array to generate images as cards. These card images were then appended to the grid div as children. Additionally, I set up an event listener for the shuffle button. However, ...

The project is experiencing difficulties in loading the Module CSS

Currently, I am working on a React module and have set up a React project to demonstrate the functionality of this module. Initially, everything was working smoothly until I encountered an issue with the webpack configuration related to the CSS loader. { ...

Transform the Bootstrap container to fill the entire height of the browser

How can I make the container height 100% of the browser without breaking the contents inside? html, body { height: 100%; min-height: 100%; } .container { min-height: 100%; height: 100%; background-color:red; } <div class="contai ...

Display the gridview using <div> elements rather than tables

Does anyone have a code snippet that can display a gridview within a <div> element instead of a table? I would greatly appreciate any assistance with this. I am trying to create a graph similar to the one I have included and would like some functi ...

Menu rollout problem when clicking or hovering

I'm facing challenges in making my menu content appear when a user clicks or hovers over the hamburger menu. My app is built using Angular, and I've written some inline JavaScript and CSS to achieve this, but the results are not as expected. Here ...

Setting an error state on the parent div of a checkbox

I am facing an issue with styling a standard HTML checkbox when it is in an error state. Since it's not possible to style the checkbox directly, I am attempting to apply the styling to its parent div instead. Consider this example: <div class="fo ...

Box containing text going in both directions

I am trying to recreate a div structure that features a circle emoji at the top and two text elements at the bottom. However, my attempt is not producing the desired result. Here is my current code: .container { width: 70px; height: 400px; backgroun ...

Implement a Selection Feature in Angular

Currently, I am working on an application where users can add new rows with the same fields. One of the requirements is to allow users to add an option to a select element. While I have successfully implemented this in jQuery, I am facing challenges integr ...

Verification of radio status against boolean value stored in the database

Here is what I have: https://i.sstatic.net/4WTiM.png https://i.sstatic.net/YB6zB.png A boolean value is stored in the database, so when "yes" or "no" is checked, the radio button should also be checked and reflect the boolean value in the database. Can ...

Formatting Issue with HTML Form (Width Exceeding Specifications)

Currently, I am in the process of creating a table that contains various forms and buttons within the cells. However, there seems to be excess space between the buttons which is giving the appearance of the form being too wide. I have been attempting to di ...

What could be causing my fixed header to disappear in Safari 5?

I am experiencing a strange issue with my fixed header on Safari 5 for iPad. The header disappears once it scrolls down to a certain point, even though it works fine in IE, Firefox, Chrome, and the latest version of Safari. Has anyone else encountered this ...