htmlcsswordpressvisual-composer

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>

How do I only grab the text inside the first p tag ("To This Website")? I can't give it an class or ID, because it's done with visual composer in wordpress and I can also not style it in wordpress, but I only need to style that part.


Solution

  • Maybe something like this?

    https://codepen.io/anon/pen/YGpvxE

    Snippet Example:

        p:first-child {
          color: red !important; /** Use important only in very rare situations **/
        }
        
        p b {
          color: initial;
        }
     <div>
        <p>
        <b>Hello there, welcome</b>
        <br/>
        To this website
        </p>
        <p>Some other text</p>
        </div>

    Edit:

    To override the inline styling, you can use !important in your CSS.