Results 1 to 2 of 2

Thread: how do I make hover work in ie?

  1. #1
    Join Date
    Sep 2006
    Posts
    108

    how do I make hover work in ie?

    Is hover suppose to work in ie7? It is not working for me.
    What could I add to this to get it to work in ie?


    This is my code:

    td.name
    {
    background: url(pic1.jpg) no-repeat;
    }

    td.name:hover
    {
    background: url(pic2.jpg) no-repeat;
    }

  2. #2
    Join Date
    Feb 2006
    Location
    Salisbury UK
    Posts
    4,332
    It does work in IE7 and Firefox but probably not in IE6 which doesn't support the hover attribute except on a href.

    I tested with a table and a div. It's best to give a width and height if you have no text in the td or div.

    td.name and td.name:hover styles will also work with td but I had to leave out the td to get it to work with a div as well.

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
       "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    
    <html>
    <head>
    <meta name="keywords" content="Wickham"/> 
    <meta name="description" content="Test items"/> 
    <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"/>
    <title>Test</title>                  
    
    <style type="text/css">
    .name
    {
    background: url(orangew90x90.jpg) no-repeat;
    }
    
    .name:hover
    {
    background: url(greenw90x90.jpg) no-repeat;
    }
    
    </style>
    </head>
    
    <body>
    
    <table width="90" height="90"><tr><td class="name">
    </td></tr></table>
    
    <div style="width: 90px; height: 90px;" class="name"></div>
    
    </body>
    </html>
    Code downloaded to my PC will be deleted in due course.
    WIN7; IE9, Firefox, Opera, Chrome and Safari for Windows; screen resolution usually 1366*768.
    Also IE6 on W98 with 800*600 and IE8 on Vista 1440*900.

Similar Threads

  1. Trying to make a Database work
    By Mandroo in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 04 Oct 2006, 05:00 PM
  2. Two methods make our webpage design work more easy
    By abelz22 in forum Web Design, HTML Reference and CSS
    Replies: 0
    Last Post: 08 Jun 2006, 10:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •