1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Can a div or span be an actual link?

Discussion in 'CSS' started by le007, Oct 3, 2007.

  1. codyrockx

    codyrockx Peon

    Messages:
    33
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #21
    I definitely agree, although my point is that if this is going to be in more than one location such as several pages on a site, you've placed your control into the html code rather than a central css file. Usually as far as a userbase, if you were to disregard a browser in an instance such as this where it's simply going to be an extra emphasis on the link, that's ok. Primarly for the reason that you are not limiting functionality based what browser someone may be using. Rather than limiting one person, you're simply making the product look better in other browsers. It's the same as the websites that used to use the blink tag because Internet Explorer enabled them to. As long as it doesn't limit usuability then you usually want to make it easier to manage on the programmer's end.
     
    codyrockx, Oct 3, 2007 IP
  2. Arnold9000

    Arnold9000 Peon

    Messages:
    241
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #22
    If something is going to be repeated on every other page on the site, then a server side include should be used. CSS can be useful for things like repeating elements, but that isn't really what it was made for, it just so happens to help out with that sometimes. Don't mind me, but I've had people consider me to be a hack if I can't get all browsers to match perfectly.
     
    Arnold9000, Oct 3, 2007 IP
  3. le007

    le007 Well-Known Member

    Messages:
    481
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #23
    Ok... for my next trick...

    Here's the work in progress... maybe I will just go with the JS but here's the code anyway!

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <style>
    #link1
    {
    display block;
    position: absolute;
    background: black;
    color:white;
    width: 300px;
    height: 100px;
    margin-top: 60px;
    margin-left: 100px;
    }
    
    #link1:hover
    {
    position: absolute;
    background: red;
    color:white;
    width: 300px;
    height: 100px;
    margin-top: 60px;
    margin-left: 100px;
    }
    
    </style>
    </head>
    <body>
    
    
    <a href="link.html" id="link1"><div style="background:green">Working...</div></a>
    </body>
    Code (markup):
     
    le007, Oct 3, 2007 IP
  4. soulscratch

    soulscratch Well-Known Member

    Messages:
    964
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    155
    #24
    Why would you want 6 lines of text to be clickable? Referring to the whole region of the division and text?
     
    soulscratch, Oct 3, 2007 IP
  5. Arnold9000

    Arnold9000 Peon

    Messages:
    241
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #25
    This is good, but for your next trick, you need to add multiple links within your larger link. He wasn't looking for the larger container to be linkable, only to change color when someone hovers over one of multiple inner links. Good idea to try and make the larger area a link to get around IE's crippledness of only offering the hover psuedo class for the <a> tag. I suppose the question really comes down to, can you nest links? Because that's apparently what you'll have to do.

    Good stuff. I'm anticipating.
     
    Arnold9000, Oct 4, 2007 IP
  6. Arnold9000

    Arnold9000 Peon

    Messages:
    241
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #26
    He actually later said that he didn't describe it correctly at first. What he wants is a larger nav area or container that lights up when one of the links of the nav is moused over. The only way that I know how to do that is by accessing the container element (div, whatever) through the javascript DOM, which another user has already posted in a very simple way. But he still wants to try and do it using all CSS and no javascript. Currently, from what I know, I don't think that's possible to do and have it work in all browsers, but I could be wrong.
     
    Arnold9000, Oct 4, 2007 IP
  7. le007

    le007 Well-Known Member

    Messages:
    481
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #27
    As you can all see from my code, its a work in progress, no positioning of the div etc... but it turned out to be exactly the concept I wanted! Thanks for thjs rollover option but in the end with a few ideas I've kinda answered my own question! I have tested it with nested divs and a href and both work in FF and IE! Thats sweet as! Feel free to roll with the idea. For me, I just needed something to emphasise where specific links were - this does it nicely for me!

    Happy cssing!
     
    le007, Oct 4, 2007 IP
  8. le007

    le007 Well-Known Member

    Messages:
    481
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #28
    Arnold9000:
    Hey all, thanks for the js suggestion but in the end I've actually answered my own question! What I needed was specific link/s to be highlighted and emphasised more - with my code I get this result! I've tested it with nested divs and a href and it all works in both IE and FF! Happy Days! Just with some clever ideas can come gr8 results so for me it works beautifully!

    I've enjoyed this article hope you all have too!
    Leo
     
    le007, Oct 4, 2007 IP