Adding a CSS class to Google DoubleClick For Publishers Ad
As the title suggests I am currently looking for a way to add a开发者_如何学编程 CSS class to the ad divs on my site provided by Google's DoubleClick For Publishers.
I have a sidebar on the site containing my ads which I wish to display in such a way that they have a 10px margin separating each ad.
I have a workaround at the mo by targeting every google div in the stylesheet and setting the margin-top to 10px. So:
#google_ads_div_MySite_Home_MPU1_300x250_ad_container, #google_ads_div_MySite_SiteWide_LargeButton1_300x100, #google_ads_div_MCV_SiteWide_LargeButton2_300x100{margin-top:10px;}
However this is incredibly messy and involves meticulously checking the stylesheet to check every single ad has been defined. Across a large site this can be a nightmare.
Can anyone help?
Instead of modifying the id of the ad div with your css, apply your CSS to the child of the container of the ads.
Your html probably look like
<div>
<div id="google_ads_div_MySite_Home_MPU1_300x250_ad_container">some ad</div>
<div id="google_ads_div_MCV_SiteWide_LargeButton2_300x100">some other ad</div>
</div>
just change it to
<div class="ad_container>
<div id="google_ads_div_MySite_Home_MPU1_300x250_ad_container">some ad</div>
<div id="google_ads_div_MCV_SiteWide_LargeButton2_300x100">some other ad</div>
</div>
and in css :
.ad_container div {margin-top:10px}
精彩评论