[英]How to only style the text inside a p tag
<div>
<p style="font-size=40px;">
<b>Hello there, welcome</b>
<br/>
To this website
</p>
<p>Some other text</p>
如何只抓取第一个p标签(“到此网站”)中的文本? 我不能给它一个类或ID,因为它是在wordpress中用可视化作曲家完成的,我也不能在wordpress中对其进行样式设置,但是我只需要对该部分进行样式设置。
也许是这样的吗?
http://codepen.io/anon/pen/YGpvxE
下面的示例
p:first-child { color: red !important; /** Use important only in very rare situations **/ } pb { color: initial; }
<div> <p> <b>Hello there, welcome</b> <br/> To this website </p> <p>Some other text</p> </div>
编辑:要覆盖内联样式,可以在CSS中使用!important
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.