How-To: Make a clickable background takeover

bgtakover_header

With advertisers slowly getting over the banner ad thing, background takeovers (clickable background images) are becoming more popular. Although they’re a pain in the ass (I accidentally click on them all the time), they’re quite valuable to advertisers, and thus a good revenue stream.

Making them work, however, can be a total bitch. Here’s how I do it. It’s definitely not a science, and I’m not winning any CSS awards, but it works.

There are three steps.

Step 1: Create Background Image

Your background image should be the width of your content area, plus however wide the graphics on the side are. So if your content area is 800px wide, and the creative on the sides is 200px wide each, your image is 1200px wide, by whatever you want high. It’s good practice to ensure that the background takeover creative fades out to a solid color. Then, you set the background color of your body background to that color, so the creative fades into the rest of the site nicely.

Step 2: The CSS

Part 1: Link class (#skin)
Part 2: Background image class (#background)

Here’s the code:

<style type="text/css">
#skin {
	position: absolute;
	width: 100%;
	height: 800px;
	margin-left: auto;
	margin-right: auto;
	top: 0px;
	left: 0px;
	z-index: 1;
}

#background
{
	background: url(background_takeover.png) no-repeat 50% 0;
	background-color: #ffffff;
	height: 800px;
	position: absolute;
	width: 100%;
	top:220px;
	z-index: 1;
}
</style>

Step 3: Add to your layout

Add this to your site’s page template:

<div id=”background”><a href=”http://yourlinkgoeshere.com” id=”skin”></a></div>

Then, just make sure your content div wrapper has a z-index greater than 1, and you’ve got a clickable background and are making billions of dollars.

Bonus Step:

Crank some tunes!

October Fire (with @FreyDrew) by harvitronix


  • http://twitter.com/DrMacenstein DrMacenstein

    Hey, thanks for the tip. Obviously I can’t get it working though. :)
    sort of a newb, so what does your last line about the z value mean?

    if you have a sec to look at the source code, my test site is
    http://boomba.com/macensteintest/

    trying to put a clickable add behind the whole page.
    I can easily add the graphic using the built-in wordpress BACKGROUND option, just not get the clickable areas.

    thanks
    - The Doc

  • Anonymous

    Sorry for my slow response.

    I just checked out your site and it looks like you got it to work one way or the other?

    The last line about the Z-Index just means to make sure your main content div has a z-index higher than the z-index of your clickable background. Z-index controls the layering of your divs. 0 is the furthest away from you (deepest), 2 is closer to your face.

    Cheers,
    Matt.

  • az

    Thanks for posting.  This works nicely.

    For some reason, when the width on the #background div is 100% it creates a horizontal scroll bar.  Setting the width to 99% fixed that.

    http://azwebvideo.com/test/

  • Anonymous

    That’s interesting. Could it be because your background div has a border around it? Thanks for the tip, though.

    Matt.

  • RLynn

    This sounds like what i’m looking for, but I can’t seem to get it to work on WordPress. Any suggestions? I’ve added the CSS code to my style.css file and I added the html code to the page.php file. Nothing happens. Help would be greatly appreciated!

  • http://destroy.theinna.net zillz

    perhaps? http://bbm.blackblogmedia.com/post/12331980673/clickable-background-ad

  • http://juicytings.com/ juicytings.com

    Can you just point out which part of the coding above is the HTML coding. New at this… it all just looks to me like Css. where does the ad image get added in the css or the html? 

  • http://www.fastlanemag.com/ FastLaneMag.Com

    No matter what I do or how I try it nothing works for me for some reason. You are not very clear as to where to place these codes as in what files.

  • Pingback: Best Way to Make Site Skin a Clickable Link | GeekFreak

  • http://www.devilsmmo.com/ DevilsMMO

    The last one (div part) goes into your html or template file, the first bit (CSS) goes into your CSS files. (ideally)

  • http://ghanaweekly.net Derick

    I’ve tried it and nothing happens. 

  • http://www.vickyz.com/ abhishek singh

    not able to set up plz help 
    http://www.vickyz.com/ :(