将 CSS 类添加到 Google DoubleClick For Publishers 广告

发布于 2024-11-19 01:47:53 字数 492 浏览 7 评论 0原文

正如标题所示,我目前正在寻找一种方法,将 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

脱离于你 2024-11-26 01:47:53

不要使用 css 修改广告 div 的 id,而是将 CSS 应用于广告容器的子级。

您的 html 可能看起来

<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>

只是将其更改为

<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>

css :

.ad_container div {margin-top:10px}

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}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文