h2 underline:none problem

Discussion in 'CSS' started by Silver89, Apr 12, 2008.

  1. #1
    Hi,

    I have a H2 in an <a href where the text inside is underlinedon hover, but i don't want the h2 to be underliend on hover.

    The following is the html..


    <div class="forumTopics">
    <a href="">
    <h2>Header i don't want underlined on hover</h2>
    Underlined on hover text
    </a>
    </div>
    
    HTML:
    This is what i've tried so far..

    
    .forumTopics a h2:hover{
    	text-decoration:none;
    	}
    
    .forumTopics h2:hover{
    	text-decoration:none;
    	}
    
    a.forumTopics h2:hover{
    	text-decoration:none;
    	}
    
    .forumTopics h2:hover{
    	text-decoration:none;
    	}
    
    h2.forumTopics:hover{
    	text-decoration:none;
    	}
    HTML:
     
    Silver89, Apr 12, 2008 IP
  2. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #2
    First off, anchors cannot contain headings because inline elements cannot contain block level elements. Swap the order of the anchor and heading (in other words, put the link inside the heading) and then adjust your CSS accordingly.
     
    Dan Schulz, Apr 12, 2008 IP