Is a hidden CSS div for a hyperlink possible?

Discussion in 'CSS' started by RoxD, Jan 20, 2010.

  1. #1
    With this skin there was originally a text link at the top instead of the image, but since I removed the text and added the image I can't find out how to make the image link to the forum index and IMO that's somewhat important. The page is http://stiqy.com/forum/, any help is very much appreciated.

    Edit: Just wanted to add that it doesn't have to be CSS, any hack will be fine as long as it works with the modern browsers. I did see this but it's way over my head if it's even what I'm looking for.

    Thanks [​IMG]
     
    Last edited: Jan 20, 2010
    RoxD, Jan 20, 2010 IP
  2. Wtfuxbbq

    Wtfuxbbq Peon

    Messages:
    61
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You should just display the image with the img tag and link it like that.

    But if you want to keep the div..you can put an empty anchor tag inside the div with the div's height and width.
     
    Wtfuxbbq, Jan 20, 2010 IP
  3. RoxD

    RoxD Active Member

    Messages:
    154
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #3
    How would I add the IMG tag in the same location it's in now?
     
    RoxD, Jan 20, 2010 IP
  4. nitrox

    nitrox Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Let me see if I get this straight - you added the Logo image as a background image in CSS, and now you want it clickable.

    Now I see the link is still there, but there's no text to click. So you can try these methods:

    Method 1: Add the image right there instead of through CSS:
    Change this:
    <div id="Title"><a href="http://stiqy.com/forum/"></a></div>
    To:
    <div id="Title"><a href="http://stiqy.com/forum/"><img src="http://stiqy.com/forum/themes/organic/styles/default/logo.png" alt=""/></a></div>

    Method 2: Add some invisble "text" in the link, to make the area clickable
    Change it to this instead:
    <div id="Title"><a href="http://stiqy.com/forum/"> &nbsp; &nbsp; &nbsp; &nbsp; <br /></a></div>

    Every "&nbsp;" is a space character, and every <br /> is a new line, so you can add as many lines you want if you want the clickable area to be high.

    Method tree: Javascript.
    This might be the easiest, but the most "hacky".

    Change this:
    <div id="Title"><a href="http://stiqy.com/forum/"></a></div>
    To:
    <div id="Title" onclick="location.href='index.html" style="cursor:hand; cursor:pointer;"><a href="http://stiqy.com/forum/"></a></div>

    (change index.html to wherever you want the link to go)


    Hope this helps, let us know:)
     
    nitrox, Jan 22, 2010 IP
  5. Dogs_and_things

    Dogs_and_things Active Member

    Messages:
    97
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #5
    <a href="www.some-url.com"><img src="some-image.url" title="something" alt="something" /></a>
    Code (markup):
     
    Dogs_and_things, Jan 22, 2010 IP
  6. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Better:
    Keep a space in the anchor tag so it's even clickable in Opera.

    Use CSS to make it a larger block.

    <div id="Title"><a href="http://foo.com/foo/"> </a></div>

    #Title {
    position: relative;
    }
    #Title a {
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    }

    Uh, this is assuming nitrox is correct as far as the original problem... I had trouble understanding the OP's text and did not look at the site linked.
     
    Stomme poes, Jan 24, 2010 IP
  7. RoxD

    RoxD Active Member

    Messages:
    154
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #7
    Thanks for the help everyone, I've been very busy so I haven't had a chance to try it but I will report back as soon as I get a chance :)
     
    RoxD, Jan 25, 2010 IP