1

I know how to override css using !important but what if the HTML is

<p style="font-weight:bold;">hello</p>

I do not want to affect the other P but only P with style="font-weight:bold;"

JeVic
  • 681
  • 11
  • 31

3 Answers3

1

You can use the style attribute in css as you would with any other attribute.

p[style*="font-weight:bold"] {
    font-weight: bolder;
}
D1__1
  • 200
  • 7
0

already figured it out using p[style]

JeVic
  • 681
  • 11
  • 31
0

You can do this by:

p[style*="font-weight: bold"] {
    /* some styles */
}

You can also use this technique for selecting HTML tags with other attributes like target.

You can look up here for more information on selectors:

Selector Reference

True Alpha
  • 112
  • 11