Using a heading tag for a text rollover

Discussion in 'CSS' started by bad_bob00, Jul 10, 2007.

  1. #1
    Hi there,

    I've got some <h2> headings that I want to be text rollovers. Is there a way of doing this?

    My <h2> heading is linked to part of my stylesheet:

    Would I be able to add the rollover code directly to this? And what code could I use?


    Thanks for any help.
    Matt
     
    bad_bob00, Jul 10, 2007 IP
  2. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It won't work in IE 5/6 without a .htc file (since IE doesn't understand what I'm about to show you on anything but links, and wrapping your heading around an anchor will invalidate your HTML), but I'd use :hover for the effect. Like so:

    
    #content h2:hover {
        background: #063287;
        color: #489315;
    }
    
    Code (markup):
    (the colors were chosen at random)
     
    Dan Schulz, Jul 10, 2007 IP
    bad_bob00 likes this.