将 CSS 类添加到 Google DoubleClick For Publishers 广告
正如标题所示,我目前正在寻找一种方法,将 CSS 类添加到 Google 的 DoubleClick For Publishers 提供的网站上的广告 div 中。
我的网站上有一个侧边栏,其中包含我的广告,我希望以 10 像素的边距分隔每个广告的方式显示该广告。
我有一个解决方法,通过定位样式表中的每个 google div 并将 margin-top 设置为 10px。所以:
#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;}
然而,这非常混乱,需要仔细检查样式表以检查每个广告是否已定义。对于大型网站来说,这可能是一场噩梦。
有人可以帮忙吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要使用 css 修改广告 div 的 id,而是将 CSS 应用于广告容器的子级。
您的 html 可能看起来
只是将其更改为
css :
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
just change it to
and in css :