Mouseover feature for image is functioning, but having issues with alignment

I am currently working on displaying images upon mouse over actions. While the functionality is working perfectly, I am facing an issue where the displayed images appear below and the last image takes up space at the bottom. To rectify this problem, I would like the bottom of the last text (which reveals a picture upon mouse over) to be closer to the text itself rather than being close to the top.

Here is the HTML code:

<td valign="middle" class="table_td td top" style="width: 347px">
    <span class="feature_text" style="cursor:pointer" onMouseOver="ShowPicture('Style16',1)" onMouseOut="ShowPicture('Style16',0)" id="a16">Storefront Window Decal</span>
<div id="Style16" style="position:absolute; visibility:hidden; border:solid 0px #CCC; padding:5px">
    <img src="images/window-decal-image.gif">
</div>

The JavaScript code associated with this functionality:

function ShowPicture(id,Source) 
{
    var vis, elem;

     if (1 == Source)
     {
     vis = "visible";
     }
     else if (0 == Source)
     {
      vis = "hidden";
     }
    else
    {
     throw new RangeError("Unknown Flag");
    }

    if (elem = document.getElementById(id))
    {
      elem.style.visibility = vis;
    }
    else
    {
      throw new TypeError("Element with id '"+id+"' does not exist.");
    }
     return vis;
    }

Thank you for any assistance provided.

Answer №1

Although I share the same viewpoint as @epascerello's argument, have you experimented with position:absolute; bottom: 0px;?

UPDATE:

Hold on, that will position the bottom of your tooltip in line with the base of its containing position: relative element. To align the bottom of your tooltip with the top of the container, utilize bottom: 100%.

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

Update issue with Material UI table rows when using setState method

Currently, I am facing an issue with passing content to my Material UI table using props. When props are passed explicitly, it works fine. However, I need to retrieve the props from a Firestore database and then pass them to the table. To achieve this, I a ...

Ending the loop of a jQuery JSON array when reaching the final row

I have a function that retrieves a JSON array and shows the results as a list with ten items. However, if there are fewer than ten results, it starts over from the beginning. This is my code: $.ajax({ url: 'http://www.entertainmentcocktail.com/c ...

Transforming a Bootstrap 4 dropdown navbar by replacing the caret with Fontawesome 5 icons for Plus and Minus

After spending several days trying to find a solution, I am still struggling. I have managed to create a responsive Navbar with Dropdowns using Bootstrap 4. Now, my goal is to replace the caret with a Plus and Minus sign at the end of each row on small dev ...

Troubleshooting issues with executeScript in Internet Explorer driver for Selenium

Unable to execute any JavaScript using "executescript" during functional tests in IE, while it works perfectly with Firefox. Despite hours of searching on Google, I haven't been able to find a solution. Here is an example of how I am trying to call i ...

Display a jQuery alert when an AJAX post request exceeds its timeout limit

I have been working on creating a feature to notify users when their $.post() request times out. To achieve this, I have implemented the following code snippet: //when ajax request start show overlay $(document).ajaxStart(function(){ ...

Upgrade button-group to dropdown on small screens using Bootstrap 4

I am currently developing a web application and incorporating Bootstrap 4 for certain components such as forms and tables. Within the design, I have included buttons grouped together to display various actions. Below is an example code snippet: <li ...

Can you set up an automatic redirect after a payment is made on paypal.me?

Is there a way to automatically redirect users to a "successful payment" landing page after they make a payment on paypal.me? While PayPal offers an "Auto Return" feature, I am uncertain if it is applicable for paypal.me or if there are alternative methods ...

The video attribute in HTML is malfunctioning on the react webpage

Currently working on setting up a basic portfolio layout with a video playing in the background on loop. However, despite making some adjustments and modifications, the video is not showing up as expected. Any insights or suggestions on what might be causi ...

I'm experimenting with crafting a new color scheme using MUI, which will dynamically alter the background color of my card based on the API

I am attempting to create a function that will change the colors based on the type of Pokemon. However, I'm not sure how to go about it. Any suggestions or ideas!? Check out where I'm brainstorming this logic [This is where the color palette sh ...

Using JavaScript, learn how to extract query parameters and encoded information from a URI

I am looking for a specific module in order to extract information from query parameters within a URL. The format includes 2 query parameters and an encoded piece of data. Do I need to use split functions or is there a more direct approach available? Sampl ...

CSS not displaying properly

I've been working on a React.js web app with Material UI components. The challenge I'm facing is with one specific component that handles the website management and displays a preview of custom content. This website, unlike the rest of the app, u ...

How to use jQuery to extract a particular text from an anchor tag

If I want to choose a specific anchor text and make changes to it, I can do so by targeting anchors with a certain href attribute. For example, on a page with multiple unordered lists, each containing different links: <ul> <li><a href="v ...

Binding Data in Vue Multiselect

After extensive searching, I stumbled upon an amazing searchable select Vue component that has caught my eye: https://github.com/monterail/vue-multiselect. However, there seems to be a small issue when it comes to feeding it an array of objects as options ...

Retrieve the identification number for each item within my array

I am working with an array of objects, each having a unique ID. My goal is to find the index of each object in the array. I am currently using Angular, however, I am restricted from using $index for this particular task. $scope.getObjectIndex = fun ...

I currently have an array of strings and wish to print only the lines that include a specific substring

Here i want to showcase lines that contain the following strings: Object.< anonymous > These are multiple lines: Discover those lines that have the substring Object . < anonymous > Error: ER_ACCESS_DENIED_ERROR: Access denied for user ' ...

Guide on adjusting the value for a Bootstrap slider

Using the bootstrap slider, I am trying to configure a way to assign a value to the handle from another variable. Although I came across a method that uses the data-slider-value attribute for this purpose, it did not work for me. <input id="gravite" na ...

Tips for creating a flexbox layout that is responsive to different screen

Currently, I am using flex to ensure that the two inner div elements have the same height. However, the design is not responsive as it appears perfectly in a full-width window but gets squeezed on mobile devices. Is there a solution to this issue? Are th ...

The shared global variable or store feature is currently not functioning as expected in Vue JS

Currently, I am in the process of developing a Simple Web application using Vue JS for educational purposes. Although I am new to Vue JS and still learning the ropes, I have encountered an issue with sharing a state variable across all components. In my a ...

Angular4 allows for the creation of a div that can horizontally scroll

Below is the HTML code I am working with: <div class="card-deck" fxLayout.xs="row" style="overflow: scroll; height:100%"> <md-card style="width:10rem" *ngFor="let make of filteredMakes" (click)="goToModels(make.niceName)" class=" ...

Shorten a data point in JSON code

I'm currently in the process of developing a stock widget that utilizes JSON to retrieve data from the Yahoo API/YQL console. I am specifically working with values extracted from the key ChangePercentRealtime, however, the values are longer than what ...