Linked header how to?

Discussion in 'CSS' started by uniqueasitis, Jul 25, 2007.

  1. #1
    I have downloaded cs templates and want to modify them. The headings are not linked headings. I would like to make linked headings which means that the heading retains its css styling but can be clicked (basically I want to enclose the heading in the <a href="">tag) but when make it linked the styling of the links takes over. How do I fix this?
     
    uniqueasitis, Jul 25, 2007 IP
  2. Angelosanto

    Angelosanto Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Put the heading styling into the anchor section
     
    Angelosanto, Jul 25, 2007 IP
  3. soulscratch

    soulscratch Well-Known Member

    Messages:
    964
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    155
    #3
    h2 a, h3 a, h4 a {
    // your rules for headers here to override the anchor rules.
    }
     
    soulscratch, Jul 25, 2007 IP
  4. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You need to put the anchor inside the heading element, as inline elements cannot contain block level elements.

    
    <h1><a href="#">This is a linked heading</a></h1>
    
    Code (markup):
    From there, you style the link so that the display is set to block and that a width is specified (in this case, 100%) after removing the underline. You can also set a color and background for the anchor as well, if you want.

    
    h1 a {
        background: #CFC;
        color: #000;
        display: block;
        text-decoration: none;
        width: 100%;
    }
    
    Code (markup):
     
    Dan Schulz, Jul 25, 2007 IP
  5. uniqueasitis

    uniqueasitis Peon

    Messages:
    661
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thank you very much. This one problem has been driving me mad. I am very new to CSS. I have always used tables and I know this question may have seemed dumb. Thanks again! Could you also refer me to some resource whether paid or free which I can use to master CSS so that I don't have to ask sillly questions like this?
     
    uniqueasitis, Jul 25, 2007 IP
  6. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Dan Schulz, Jul 25, 2007 IP