Position Span over Anchor??

Discussion in 'HTML & Website Design' started by wd_2k6, Jun 5, 2008.

  1. #1
    Hi Basically I want a 100% by 150px DIV clickable.
    Inside it is a picture, a title, and some text.
    So I have something like the following:

    <a href=#"><img .. /> Title and Text</a>

    I then set the a to display block, 150px height and 100% width, with some hover effects this all works great.

    However I want it so that only the title is inside the anchor tag for SEO reasons. So it looks like this:

    <a href="#">The Title</a> /*This is lets say 450px wide and 150px height*/
    <span>Pic and Text</span> /*Add Negative Margin Top to make it appear inside the anchor area*/

    I then tried to add negative margin to the SPAN so it looked as though it was in the anchor, but if the span pic or text is hovered over it can't be clicked as obviously it isn't the anchor tag but it is hovererd over it but i need the whole over the anchor area to be clickable?

    Is it possible? :(
     
    wd_2k6, Jun 5, 2008 IP
  2. mr-white

    mr-white Banned

    Messages:
    58
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    anything thing is possible with coding
     
    mr-white, Jun 5, 2008 IP
  3. q7m

    q7m Well-Known Member

    Messages:
    1,178
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    150
    Digital Goods:
    1
    #3
    
    <a href="#">The Title</a> /* block 150px height */
    <a href="#" style="margin-top: -150px">Pic and Text</a>
    
    Code (markup):
     
    q7m, Jun 5, 2008 IP
  4. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks zeegal but I was hoping not to have the pic and text inside the anchor, however I still want it to appear over the title anchor and be clickable, so I guess it would need to be kind of see-through but still visible :s
    I don't think it's possible, I guess the pic and text would have to be inside the anchor.
     
    wd_2k6, Jun 6, 2008 IP
  5. steelfrog

    steelfrog Peon

    Messages:
    537
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #5
    If I understand correctly, you should be able to achieve that affect by setting the ancor to a class which is in turn set to specific width and height.

    Here's an example. Not sure if this'll work since I'm just pulling this from my head, but tweak around this idea.

    
    a.block {
        display: block;
        height: 150px;
        width: 150px;
        }
    
    Code (markup):
     
    steelfrog, Jun 6, 2008 IP
  6. q7m

    q7m Well-Known Member

    Messages:
    1,178
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    150
    Digital Goods:
    1
    #6
    Then try this:
    
    <a href="#">The Title</a> /* block 150px height */
    <span style="margin-top: -150px; cursor: pointer;" onclick="javascript: document.location.href='#';">Pic and Text</span>
    
    Code (markup):
     
    q7m, Jun 6, 2008 IP