Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8164731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:22:54+00:00 2026-06-06T19:22:54+00:00

I have a image, and i want it to change to another one when

  • 0

I have a image, and i want it to change to another one when the mouse passes by.
It seems correct to me, but it always appear big, in its normal size (128px x 128px), and BEHIND the another image. (the other one is inside a div with z-index:1), and the one with the mouseover img have z-index:999

here is my css

.class1{
    max-width:64px;
    max-height:64px;
}
.class1:hover{
    background-image:url(http://img195.imageshack.us/MOUSEOVER_IMAGE.png);
    width:64px;
    height:64px;
    z-index:999;
    background-position:top center;

and here is my image

<a href="http://mylink"><img class=class1 src="http://imageshack.us/NORMAL_IMAGE.png" alt="some text here" /></a>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T19:22:55+00:00Added an answer on June 6, 2026 at 7:22 pm

    There are a couple issues going on here. Like Tobas mentioned, you’re using a background image on the link, but you still have an image child element. z-index will not bring a parent element’s background above a child element.

    So you have a couple options:

    1: Change the img opacity to 0 on hover:

    img.class1:hover { opacity: 0 }
    

    And use background-size on the background image:

    a:hover {
      background: url(...);
      background-size: 64px 64px;
     }
    

    2: Remove the child image entirely, and have the images be swapped out as backgrounds to the link. This makes sense if the image presents no semantic value.

    a { background: url(image1.png); }
    
     a:hover { background: url(image2.png); }
    

    3: Swap the image itself with javascript/jquery:

     $('img.class1').hover(function(){
        $(this).attr('src','image2.png');
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to have the background image change form one to another and fade
i have many div's with the same background image and i want change this
I have a Blackberry project in which I want to change normal image to
I have problem with dynamically created image (JavaScript). I want to change the innerHTML
i have two buttons in menu on mouse over the button change image to
I have an image on my page and want that it change the position
I want to have a image in my Flash file which can be changed
I have an image and want to read the pixel values in a particular
my problem is: I have an image and want to mark some areas over
I have an image that I want to position in the right and repeat

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.