Forum Moderators: open
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 :)
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.
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>
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]
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.