Monday, August 3, 2009

How to force your host's ads to the bottom of your web page

If you have a free host, chances are that you also have the host's ads running on your web page. This is certainly the case for me; however, I didn't really mind until recently. Up until yesterday, all of their ads automatically appeared at the bottom of my pages. Yesterday, I had a page where the ad kept appearing at the top of my page covering some of the page's content. My best guess for why this happened is that I used absolute positioning instead of relative. Thus, when I tried the css code "clear:both;" nothing happened. I searched google, and I found no solutions. Finally, I developed a fix. It might not be the most graceful fix, but it works. So if you have this same problem (ads appearing on top of your content which is positioned absolutely) below is some code that you can use.

In your stylesheet add the lines:

#thediv{
float:left;
clear:both;
margin: 0px 0px 500px 0px; }

Then, in your html, just inside the body tag, add the following:

<div id="thediv">
<br />
</div>

No comments:

Post a Comment