text-decoration-line
Example
.price-old {
text-decoration-line: underline, line-through;
}.price-old {
text-decoration-line: underline line-through;
}Several line values are separated by spaces; with a comma the declaration is invalid and gets ignored.
Common mistakes
- A sale price is crossed out with CSS only, so screen readers don't know it is the old price.
- Setting
text-decoration-linetwice keeps only the last value instead of both lines.
Key points
- Removed or outdated content uses
<del>or<s>, not onlytext-decoration-line: line-through. - Several lines are space-separated in one value, like
underline overline.
Interview questions
Can I combine underline and line-through?
Yes. List both in one value: text-decoration-line: underline line-through.
What is the difference between del and s?
<del> marks content removed from a document. <s> marks content that is no longer accurate or relevant.