Forum Moderators: open

Message Too Old, No Replies

How to place my skyscraper ad correctly?

         

Pasqualis

4:44 pm on Sep 30, 2005 (gmt 0)

10+ Year Member



Hi all,
I'm having difficulties placing a Google adsense ad correctly on my page. I have a vbulletin forum which uses a fixed width of 780 pixes.
Now I would like to place an adsense ad on the right side of my page, but by keeping my forum page always in the middle. The ad should look like it's just floating next to the page.

I remember I've seen it on different sites, but unfortunately I'm unable to find an example at the moment.

Does anyone have a suggestion how to place the skyscraper correcty or where I can find a good example?

Thanks in advance :)

tedster

8:23 am on Oct 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello Pasqualis, and welcome to the forums.

On the face of it, it sounds like you need some CSS positioning. If the forum page is fixed width and always centered in the window, then placing your ad code in a div that's inside the main containing div for the page. You can use position:absolute and left:aaa top:bbb rules to position the ad div to any spot you want relative to the main containing div.

Our CSS Forum [webmasterworld.com] is probably the best place you can look to work out the details.

keyplyr

9:33 am on Oct 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yes the CSS forum will get you the most on topic responses.

Here is how I put a Google skyscraper on the right side of any page;
I create an example.html file with (only) this inside:

<div style="float:right; clear: none;"><br>
Google scripting here
</div>

Then on each page where I want the ads to display I use a PHP Include to call that html file:

<?php include("directory/example.html");?>

I use PHP Includes because all my webpages get parsed for PHP anyway because of other stuff, but you can use Server Side Includes if you like. Includes make it easy to change that code all across the site, however just using the <div> code itself would be fine also.

If you need a margin around the skyscraper, or on either side - just add this to the <div>

margin:0 0 0 0;

and replace any 0 with a number followed by px. The sequence goes clockwise top, right, bottom, left - so if you wanted a 10 pixel margin on the right side of the skyscraper, it would look like this:

margin:0 10px 0 0;

and the <div> would look like this:

<div style="float:right; clear: none; margin:0 10px 0 0;"><br>
Google scripting here
</div>

Pasqualis

10:22 pm on Oct 2, 2005 (gmt 0)

10+ Year Member



Thank you all for the suggestions! :)

My website is actually only a forum and the ad should be shown on every forum page. What I have tried now is adding the following to my CSS file:

/* Skyscraper ad*/
div#skyscraper
{
position:absolute;
top:210px;
left:790px;
}

This doesn't have the effect I hoped because when I resize my browser screen, the ad moves over my forums. A good example of how I would like to have it is found here <sorry, no example sites - please see the HTML Forum Charter [webmasterworld.com]>. So actually I need to describe a position x pixels from the center? But how...

[edited by: tedster at 10:40 pm (utc) on Oct. 2, 2005]

tedster

10:45 pm on Oct 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you've got an example site, why not study their source code?

Also, when you use position:absolute the coordinates (top, left, or whatever) are going to be measured from the 0,0 point of the parent container. It sounds like your #skyscraper div only has <body> as a parent, rather than being nested in the container div for the forum page.