Quantcast
Channel: CSS strikethrough different color from text? - Stack Overflow
Viewing all articles
Browse latest Browse all 17

Answer by Mechanical snail for CSS strikethrough different color from text?

$
0
0

As of Feb. 2016, CSS 3 has the support mentioned below. Here is a snippet from a WooCommerce's single product page with price discount

/*Price before discount on single product page*/body.single-product .price del .amount {color:           hsl(0, 90%, 65%);font-size:       15px;text-decoration: line-through;/*noinspection CssOverwrittenProperties*/text-decoration: white double line-through; /* Ignored in CSS1/CSS2 UAs */}

Resulting in:Text decoration example


CSS 3 will likely have direct support using the text-decoration-color property. In particular:

The text-decoration-color CSS property sets the color used when drawing underlines, overlines, or strike-throughs specified by text-decoration-line. This is the preferred way to color these text decorations, rather than using combinations of other HTML elements.

Also see text-decoration-color in the CSS 3 draft spec.

If you want to use this method immediately, you probably have to prefix it, using -moz-text-decoration-color. (Also specify it without -moz-, for forward-compatibility.)


Viewing all articles
Browse latest Browse all 17

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>