-2

Can anybody explain why my reset CSS is overriding my more specified class CSS?

enter image description here

<div class="plan-price heading--xl">
  <span data-annual="127" data-montly="159">
    <sup>$</sup>
    <span>127</span>
    <span class="plan-month_marker heading--body_title"> /mo</span>
  </span>
</div>
jnstn
  • 191
  • 1
  • 2
  • 10

1 Answers1

2

That's how CSS works. You don't specify a value for the span, just for the outside div. The span inside is more specific as any outside selector so it will take whatever is defined for the span element.

You have to update the styling for your span element if you want it to have a different styling than the default one.

span {
  font-size: 20px;
}

.heading--xl {
  font-size: 12px;
}
<div class="plan-price heading--xl">
  <span data-annual="127" data-montly="159">
    <sup>$</sup>
    <span>127</span>
  <span class="plan-month_marker heading--body_title"> /mo</span>
  </span>
</div>
cloned
  • 6,346
  • 4
  • 26
  • 38