Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/378.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 将Google DFP广告单元标题(“广告”)添加到所有带有白色背景和填充的广告中_Javascript_Css_Google Dfp_Google Ads Api - Fatal编程技术网

Javascript 将Google DFP广告单元标题(“广告”)添加到所有带有白色背景和填充的广告中

Javascript 将Google DFP广告单元标题(“广告”)添加到所有带有白色背景和填充的广告中,javascript,css,google-dfp,google-ads-api,Javascript,Css,Google Dfp,Google Ads Api,我们有谷歌DFP广告单位在我们的网站上,我们需要添加一个“广告”文本标题和一个白色背景填充到所有的广告。设计应如下 有人能帮我实现上述目标吗?为此,我将使用css。让我们假设您的所有广告槽都有一个类“adstyle”: 此处是插入GAM iframe的位置 adstyle先生{ 宽度:自动; 背景:#fff; 填充:20px; 位置:相对位置; } 阿德斯泰:以前{ 内容:“-广告-”; 显示:块; 卫生署:100%;; 高度:30px; 字体宽度:14px; 文本对齐:居中; 利润率:0.

我们有谷歌DFP广告单位在我们的网站上,我们需要添加一个“广告”文本标题和一个白色背景填充到所有的广告。设计应如下


有人能帮我实现上述目标吗?

为此,我将使用css。让我们假设您的所有广告槽都有一个类“adstyle”:


此处是插入GAM iframe的位置
adstyle先生{
宽度:自动;
背景:#fff;
填充:20px;
位置:相对位置;
}
阿德斯泰:以前{
内容:“-广告-”;
显示:块;
卫生署:100%;;
高度:30px;
字体宽度:14px;
文本对齐:居中;
利润率:0.20px0;
}

您可能对此感兴趣:@rabsom非常感谢。我将检查上面的链接:-)我已经使用CSS完成了这项工作。非常感谢!!:-)
<div id="banner" class="adstyle">
here is where the GAM iframe will be inserted
</div>

<style>
.adstyle {
  width:auto;
  background: #fff;
  padding:20px;
  position:relative;
 }

.adstyle:before {
  content : '- ADVERTISEMENT -';
  display : block;
  witdh: 100%;
  height: 30px;
  font-weigt:14px;
  text-align : center;
  margin : 0 0 20px 0;
}
</style>