[英]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.