Solved

image doesnt swap

Posted on 2013-05-17
3
236 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
Comment Utility
I even tried this and it still doesnt swap
http://www.mymrt.net/ComputerTraining/test3.html
0
 
LVL 30

Expert Comment

by:LZ1
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

772 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

11 Experts available now in Live!

Get 1:1 Help Now