What could be causing the failure of the image to resize in this particular situation?

I have a series of three horizontal images. When hovering over each of these images, a tool-tip image is displayed. However, I am encountering an issue with resizing the tool-tip image. If I try to reduce the height and width of the tool-tip image, only a portion of the image is visible. The entire image should be displayed on hover, but this is not happening. Can someone please assist me with this?

Below is the HTML code:

<table style="width:100%" id="thumbs">
                      <tr>
                        <td><span style="cursor:pointer" id="tooltip1"><img id="img1" width="80" height="80" src="http://54.174.50.242/theme/frontend/foxplus/style/default/image/layout/OpenIcon.png"/></span></td> 
                        <td><span style="cursor:pointer" id="tooltip2"><img id="img2" width="80" height="80" src="http://54.174.50.242/theme/frontend/foxplus/style/default/image/layout/ColsedIcon.png"/></span> </td>
                        <td><span style="cursor:pointer" id="tooltip3"><img id="img3" width="80" height="80" src="http://54.174.50.242/theme/frontend/foxplus/style/default/image/layout/SecretIcon.png"/></span> </td>
                      </tr>
                    </table>

CSS code :

tr span {
    display: block;
    position: relative;
}
tr span:hover {
    z-index: 1;
}
tr span:hover:after {
    content:"";
    background-image: url('http://lorempixel.com/273/274/');
    position: absolute;
    top:50%;
    left: 50%;
    width: 273px;
    height: 274px;
} 

Please can someone offer guidance on this matter?

Here is the JS Fiddle link: Demo

Answer №1

tr span:hover:after {
    content:"";
    background-image: url('http://lorempixel.com/273/279/');
    position: absolute;
    background-repeat:no-repeat;
    background-size:contain;
    left: 50%;
    width: 100px;
    height: 100px;
}

You can use this method to reduce the size of the tooltip while still showing the entire image.

Answer №2

Give this a go:

tr span:hover:after {
content:"";
background-image: url('http://lorempixel.com/273/274/');
background-size:contain; 
position: absolute;
top:50%;
left: 50%;
width: 273px;
height: 274px;
} 

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 $_POST method to navigate within the same web page

<!doctype html> <html> <head> <meta charset="UTF-8"> <title>PHP links</title> <?php echo '<div style="background-color:#ccc; padding:20px">' . $_POST['message'] . '</div>'; ...

An issue arose while attempting to retrieve information based on the specified ID within the database

I am facing a challenge that I need help with, I have a webpage that displays questions fetched from a database and I have created a comments section for each question. How can I retrieve comments based on the post_id? I attempted to fetch them as usual bu ...

Problem with CSS3 calc function: Trouble with modulo operator

Currently using: width:calc(100% mod 320); However, it consistently returns the full width of the parent element. There doesn't appear to be anything wrong with the syntax, so it seems like a support issue. This has been tested on Chrome 37 and Fire ...

AngularJS issue 400

My angular example works fine when I try to save between 100-300 characters, but when I enter more than 1000 characters, I get an error 400 in the console. In my webservice (.asmx), calling a stored procedure works fine regardless of the character count.. ...

CSS // code that works on any device or platform

I have since the beginning been annoyed with the compatibility of CSS. Whats the best practice for coding css, that works with the most common platforms... ( IE7+, Firefox, Safari, Chrome AND iPad / iPhone, Blacberry, Android) Are there any list to be fo ...

Retrieving JSON data through a JSP file using a GET request

Seeking a way to execute a get request from a JSP file and exhibit the json response. The link for the get request will appear as follows : https://api.fda.gov/drug/label.json?search="testicular cancer" Yet, I aim to substitute the search crite ...

Is there any way to remove the two default aspNetHidden Divs in asp.net web forms?

After creating an empty webform page in asp.net, the generated code looks like this: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Threetier.WebForm1" %> <!DOCTYPE html> <html xmlns="http://www.w3.org ...

Issue with email layout formatting in Outlook 2013 on Windows 7

I have made some modifications to an email template originally designed by Campaign Monitor. The template is responsive and functions well on most email clients. However, I am facing formatting issues with the email header specifically on Outlook 2013 whe ...

Integrating Ruby code and outputting content with puts in an HTML

In my html.erb file, I have some HTML code. Within it, I included this Ruby snippet: <li <%= puts "class='active'" %>>Link</li> However, when I test the code on a Rails server, the class="active" part does not appear as expect ...

Strategies for Improving CSS Loading Speed

I have tried optimizing the CSS code for the following links, but I am still receiving an error message about optimized CSS delivery. http://fonts.googleapis.com/css?family=Droid+Sans%7CUbuntu+Condensed&ver=3.6 http://www.sampleurl.com/wp-content/th ...

XPath preceding-sibling working properly

<table width="100%" cellpadding="2" border="0" cellspacing="0"> <tbody> <tr> <tr> <td valign="top" align="left" style="width:2%"> <input id="ucRightAdd_grdList_ctl04_chkSelect" type="checkbox" name="u ...

Error: The specified path to the HTML file is incorrect, resulting in a 404 "

I am trying to display images or PDF documents on my webpage, but I am having trouble showing them due to path issues. In my directory, I have a Vue file, as well as PDF and image files. I want to run these files in my `vue.js` file, but I keep getting a ...

Owl carousel issue: Fixed position not functioning properly

To view the page with the issue, click here I am attempting to make the column (div) day/date headers sticky when they scroll out of view so that users can always see what day they are looking at. Instead of directly manipulating the header itself, I have ...

When passing a parameter in a JSP page, it returns a null value

How can I display the name of my image like so? This is a simple post request from demo.jsp to itself. <form method="post" action="demo.jsp"> <input type="hidden" id="sql" name="name" value="sql"/> <input type="image" src="images/icons/ic ...

A creative CSS technique to eliminate borders from ul elements without relying on the calc() function

I'm currently using the top bar component from Zurb Foundation and have added a 1px border at the top and a 3px border at the bottom of the nav tag. However, I am facing height issues because the ul menu inside is set to 100% height. What would be th ...

Calculate the total of the temporary information entered into the input field

I'm totally new to all of this and definitely not an expert, but there's something that really bothers me. I found a website where you have to complete a captcha to log in. It goes like this: <input type="text" class="form-contr ...

Maintain line breaks in the scanner input within an HTML element

Currently, I am utilizing a Zebra DS9908 scanner to scan a barcode and transfer the data onto an HTML page. However, I am encountering an issue with preserving all input characters. Despite attempting both a <div> and <textarea>, the line feed ...

What steps can be taken to address the issue of two components loading simultaneously?

While implementing page transitions with react-router-dom and react-spring's useTransitions, I encountered some bugs despite the transition animation working well. I believe CSS might help resolve these issues, but I am unsure about the exact approach ...

Using box-shadow with table rows

I am encountering an issue trying to add a box-shadow to tr elements within a table. The problem arises when the box-shadow does not display unless all the tr elements are set with a display property of block, as suggested in this workaround: Box Shadow in ...

Troubleshooting Loading Time Problems with Jquery's .load and .html Functions

I'm facing another issue that involves Jquery. I am currently loading content from external PHP pages using the .load function. Although it is working fine, the problem is that the loaded content just flashes in and out quickly, which doesn't loo ...