0

I have this case:

firstCSSPage.css

.wrong-parent{
   font-size: 10px;
}

.wrong-child{
   font-size: 5px;
}

secondCSSPage.css

.parent {
   font-size: 20px;
}

.html

<div class="parent">
   <div class="wrong-parent">
      <span class="wrong-child">
         Text test target.
      </span>
   </div>
   <div class="wrong-parent">
      <span class="wrong-child">
         Text test target seconde.
      </span>
   </div>
</div>

I can't change the .html and firstCSSPage.css
Can I find a way to force all text in the spans to ignore the wrong-parent and wrong-child css ?

1 Answers1

-2

Rewrite Same class in secondCSSPage.css

.wrong-parent{ font-size: unset !important; }

.wrong-child{ font-size: unset !important; }

  • 1
    The `!important` keyword should be avoided: https://stackoverflow.com/Questions/3427766/should-i-avoid-using-important-in-css https://uxengineer.com/css-specificity-avoid-important-css/ – Dai Feb 14 '22 at 16:58