Div tags in links

Discussion in 'Search Engine Optimization' started by pavlick, Nov 21, 2007.

  1. #1
    Please, help me to figure out: is it OK to put DIV tag into link like this:

    <a href="http://some_url" title="test">
    <div class="homepage_block_title homepage_block2_title">
    <h1>Click here</h1>
    </div>
    </a>

    Will it influence the search spider? will the link be indexed?

    Thanks.
     
    pavlick, Nov 21, 2007 IP
  2. eli03

    eli03 Well-Known Member

    Messages:
    2,887
    Likes Received:
    98
    Best Answers:
    0
    Trophy Points:
    175
    #2
    why do you want to put div inside the tag <a> ? i'm sure the link spider still visit the link with no problem. but it is better to follow the standard coding.
     
    eli03, Nov 21, 2007 IP
  3. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #3
    <div> is a block level tag

    <div class="homepage_block_title homepage_block2_title">
    <a href="http://some_url" title="test">

    Click here
    </a>
    </div>
     
    kmap, Nov 21, 2007 IP
  4. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    437
    Best Answers:
    0
    Trophy Points:
    0
    #4
    As kmap said, a DIV is a block-level element, and thus cannot be contained inside an inline one (such as an anchor.

    If you want the container the anchor is in to be clickable, you have to change the anchor's display from inline to block (note this does not make the anchor a block-level element, but only changes its "display state"), then give it a width and height equal to its parent container. Also, why are you using a H1 heading (which is also a block-level element) there? Are you trying to abuse it for SEO purposes, or are you trying to make the page title clickable? (Which is what the H1 element is best used as - the title of the Web page.)
     
    Dan Schulz, Nov 22, 2007 IP