【发布时间】:2015-04-24 05:18:37
【问题描述】:
好的,我正在尝试将 html/css 制作的垂直横幅广告放在 wordpress 小部件部分的文本区域内。所以我将一个textarea拖到侧栏中,并插入一些html并将相应的css添加到样式表中。但是,样式没有生效,如果我将样式应用于“textarea”类,那么侧窗格中的所有 textarea 看起来都一样......有没有办法只将 css 应用于这个特定的 textarea 而不会影响所有其他...这是代码 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;
}
【问题讨论】:
-
您可以在需要样式的文本区域添加一个不同的类并为该特定类编写 css。
-
如何向该文本区域添加不同的类? textarea 由 wordpress 在 Web 界面管理区域中添加。我知道如何向文本区域添加代码,但一旦添加文本区域就不会修改它本身
-
widget 容器是否有 id 属性?
-
@miatech 您的样式很可能只是被样式表中的其他样式覆盖。可能的情况是您只需要更具体地使用您的选择器。例如; #container-div .banner-ad-container.