好的,我正在试着把一个html/css制作的垂直横幅广告放在wordpress的widget部分的一个文本区域中。因此,我将一个文本区域拖到side列中,并插入一些html并将相应的css添加到样式表中。但是,样式没有生效,如果我将样式应用于" textarea“类,那么侧面板中的所有textarea看起来都是一样的……有没有办法只将css应用于这个特定的文本区,而不影响所有其他文本区……下面是代码html
<div class="banner-ad-container">
<div id="ad-header">
<h2>Advertise Here!</h2>
</div>
<div id="ad-1">
<h2>Place Your Ad Here</h2>
<p>buy a place in our site. We have over 2000 visits everyweek</p>
</div>
<div id="ad-2">
<h2>240x400 Ad</h2>
<p>Buy this 240x400 px ad banner and place your ad here.</p>
</div>
<div id="link-1">
<a href="http://pctechtips.org/contact/"><h4>Click here for details</h4></a>
</div>
</div>css
.banner-ad-container {
background-color: #152942;
color: white;
text-align: center;
width: 240px;
height: 400px;
}
#ad-header {
border-bottom: solid 1px white;
}发布于 2015-04-24 05:18:38
如果你想做一些特定于某个Widget的事情,而不需要依赖他们的ID,这里有一些你可以使用的东西。
https://wordpress.org/plugins/widget-css-classes/
您将一个类应用于将显示在主widget包装器中的小部件,您可以使用该包装器覆盖主Widget元素并选择子元素。
另外,如果你明确地选择了你的选择器,@mrbubbles做了一个很好的评论。
小贴士:集中使用Chrome/Firefox的元素检查器。
https://stackoverflow.com/questions/29679781
复制相似问题