Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

image doesnt swap

Posted on 2013-05-17
3
Medium Priority
?
246 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 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

876 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