PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, August 4, 2022

[FIXED] How to only style the text inside a p tag

 August 04, 2022     css, html, visual-composer, wordpress     No comments   

Issue

<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?

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

snippet Example below

    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.



Answered By - mtch9
Answer Checked By - Senaida (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing