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.

Clickable Background Image -- Possible?

Discussion in 'HTML & Website Design' started by jackburton2006, Jul 6, 2008.

  1. #1
    Hey guys, got a question for all you HTML wizards out there. I'm running Wordpress on one of my sites and I want to make the background (which is an image) clickable. Is this even possible? I can make the background any image I want, that seems easy enough (I just use "background: url(etc)" in the stylesheet for that), but I've been scouring the net for a way to make it clickable, too, but so far, no luck.

    Anyone got any ideas? I'm fresh out.
     
    jackburton2006, Jul 6, 2008 IP
  2. Rubenator

    Rubenator Peon

    Messages:
    40
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The way I see it, you can make it's container clickable. For example, if you want the body background to be clickable:

    In your HTML:
    <body onClick="javascipt: document.location = 'http://www.digitalpoint.com'">

    You add some styling so people will be aware that it is clickable:

    In your CSS:
    body {cursor: hand; cursor: pointer}


    The clickable area equals the size of the container, in this case is the whole page. Of course, you can apply this to a div.
     
    Rubenator, Jul 6, 2008 IP
    jackburton2006 likes this.
  3. skenk

    skenk Banned

    Messages:
    180
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    yeah better using a div rather than body bcos the full page when ever clicked will direct you to the image, which isn't what I think you want lol...
     
    skenk, Jul 6, 2008 IP
  4. Rubenator

    Rubenator Peon

    Messages:
    40
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Nope, if use on the body when click it will direct to the onClick's URL. And, most importantly, any link on the page will still work since those will be on top (considering that body is the "lowest" object).
     
    Rubenator, Jul 6, 2008 IP
    Smyrl likes this.
  5. jackburton2006

    jackburton2006 Peon

    Messages:
    5,296
    Likes Received:
    282
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Very nice! It works, thanks, Rubenator!
     
    jackburton2006, Jul 6, 2008 IP
  6. Rubenator

    Rubenator Peon

    Messages:
    40
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Glad it help you ;)
     
    Rubenator, Jul 6, 2008 IP