1

I have a price tag element with <del> tag. The strikethrough line isn't centered.

The following question and answers were helpful in understanding about how these styles are applied. I have tested the answer myself and it works fine and strikethrough can be centered the way I want.

CSS: Strike-through not centered through the text

.strike-center:after {
    border-top: 1px solid #000;
    position: absolute;
    content: "";
    right: 0;
    top:50%;
    left: 0;
}

http://jsfiddle.net/urjhN/

How do I remove the existing style applied by the <del> tag?

Qualc0n
  • 13
  • 3

1 Answers1

0

The following should do it:

del {
   all: unset;
}

Have a look around for modern css reset https://elad2412.github.io/the-new-css-reset/

Yoz
  • 707
  • 6
  • 20
  • It worked. See the JSFiddle https://jsfiddle.net/qualc0m/ohw0rbeL/1/. Is there a case where even `all: unset` cannot clear the strikethrough. Because in my application, the strikethrough line still exists. – Qualc0n Oct 13 '22 at 07:52
  • I posted it as another question https://stackoverflow.com/questions/74052344/create-a-persistent-strikethrough-in-del-tag – Qualc0n Oct 13 '22 at 08:04
  • if you test your app and jsfiddle in the same browser and you have different results, there might be something else overriding the all rule, or all rule not being applied at all. have a look in web inspector – Yoz Oct 13 '22 at 09:05