Solved

image doesnt swap

Posted on 2013-05-17
3
237 Views
Last Modified: 2013-05-17
Hi,
My image doesnt swap on hover and I am not sure why. I just get a blank image on hover and I checked to make sure the image exists.

  <div id="headingIconList">
         <ul>
             <li>
              
                  <div id="ic1"><a href=""><img class="mimg"  src="../images/ic1.png" alt="head2"/></a></div>


#ic1{
	margin:0;
    padding:0;
    background-image:url(images/ic1b.png);
}


#ic1 a, a:link,  {
  display: block;
  width: 100px;
  height: 100px;
}
 
#ic1  a:hover img {
    visibility:hidden;
} 

Open in new window

0
Comment
Question by:jagguy
  • 2
3 Comments
 

Author Comment

by:jagguy
ID: 39174478
I even tried this and it still doesnt swap
http://www.mymrt.net/ComputerTraining/test3.html
0
 
LVL 30

Expert Comment

by:LZ1
ID: 39174481
The CSS you give hides the #ic1 img when you hover the <a> tag. There is no "swap" function here. If you want to swap images this way, you'll need Javascript or jQuery.  You could do it with CSS if you used background images.

Can you show a live example so we can better see what your wanting to do?
0
 
LVL 30

Accepted Solution

by:
LZ1 earned 500 total points
ID: 39174497
Your HTML and CSS were both wrong.
Try this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">

#css-image-swap-1 {
    background: url("images/ic1.png") no-repeat scroll 0 0 transparent;
    height: 100px;
    width: 100px;
}
#css-image-swap-1:hover {
    background: url("images/ic1b.png") no-repeat scroll 0 0 transparent;
    height: 100px;
    width: 100px;
}

</style>
</head>

<body>

<div id="css-image-swap-1"></div>
</body>
</html>

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now