Adsense block position, CSS help

Jmart285

New member
Apr 1, 2010
30
1
0
seychellegabrielfan.com
I'm trying to position an adsense block with css. i've tried several codes and they can position, BUT if i zoom out of my site/browser the adsense block moves left. If i zoom in, it movies right. I don't want this to happen. I want the block to stay positioned relative to the other stuff on my page. Like the Header/body of my site stays centered when I zoom out, but the adsense block moves left. What code should I use?
 


Your page is divided into a left section and right, if you want it to appear inside the left section at the top, and move the featured slider down slightly, you can simply open your html file and

find the div id "leftcontent" where it says <div id="leftcontent">

add
HTML:
<div id="ad1" style="width:620px;margin-left:7px;overflow:hidden">Adsense CODE HERE</div>
and replace "adsense CODE HERE" with your embed info from your adsense ad.


If you want the ad to appear within the "featured" grey box, but not within the sliding image, but just above the slider, you want to add the above div after the line: <div id="featured"> and before the highlighted line in this image:

dz9g2h.jpg


You can take out the style="" stuff and go to your CSS file and style the div by using a statement like:
HTML:
#ad1 {
width: 600px;
height:50px;
border: solid 1px silver;
background:yellow;
margin-left:5%;
}

etc to style the div, set it's position, etc. W3Schools Online Web Tutorials is where you want to learn.
 
  • Like
Reactions: stick2Herbs
So put it between the lines:

<div id="page">
<div id="ads1">adsense code here </div>

<div id="leftandright">

then in your css file use

#ads1 {
background:black; //or what color you want
width:600px; //or how wide you want it
margin-left: 5%; //how much to indent from the left, can be px, %, or em
}