Strikethough CSS

Strikethrough CSS: How to Cross Words Off Your List with Style

Ready to start learning? Individual Plans →Team Plans →

Need to cross out text in a way that looks clean and still makes sense to users? CSS cross out text is the right tool when you want to show completion, removal, a revision, or a discount without deleting the original wording. Used well, it keeps context intact, supports accessibility, and fits everything from task lists to ecommerce pricing.

Quick Answer

CSS cross out text is usually done with text-decoration: line-through;, but the best implementation depends on meaning. Use <del> for removed content and <s> for content that is no longer accurate, then refine with text-decoration properties for color, thickness, and style. For accessible UI, keep the strike readable, consistent, and tied to a real status change.

Quick Procedure

  1. Apply text-decoration: line-through; to the text you want to cross out.
  2. Choose <del> or <s> if the text has semantic meaning.
  3. Use a reusable CSS class instead of inline styles.
  4. Adjust color, thickness, and style for readability.
  5. Test the result in light mode, dark mode, and mobile layouts.
  6. Verify screen readers and keyboard focus still make sense.
  7. Document when your team should use strike-through in the design system.
Primary CSS Propertytext-decoration: line-through;
Semantic HTML Option<del> or <s> depending on meaning
Best Use CasesCompleted tasks, removed text, outdated pricing, revised copy
Accessibility GoalKeep status visible without reducing readability
Advanced Controlstext-decoration-color, text-decoration-thickness, text-decoration-style
Common RiskUsing a strike for decoration when it should communicate status
Implementation PatternUtility class, semantic tag, then visual refinement

What Is CSS Cross Out Text?

CSS cross out text is a text decoration that draws a line through words to signal that something has changed status. It is not just a visual flourish. It tells the user, “This existed, but it is no longer the current version, the current price, or the current task state.”

That distinction matters because users often need the original text for comparison. A crossed-out price helps shoppers compare the old amount with the new one. A crossed-out task helps someone confirm what was completed without losing the original checklist structure.

The simplest mental model is this: strikethrough means “still visible, no longer current.” That is different from deleting the text entirely, which removes context and can make audits, revisions, and comparisons harder.

Common places where strikethrough makes sense

  • Task lists where completed items should remain visible.
  • Ecommerce pricing where an original price is shown next to a discount.
  • Editorial workflows where revised wording needs to stay visible during review.
  • Feature lists where deprecated options should still be recognizable.
  • Notes and checklists where status matters more than deletion.

Strikethrough is most useful when the old information still helps the user make a decision.

If you want a formal reference for the underlying text rendering behavior, the CSS Fonts and Text modules are documented by the W3C CSS Text Decoration specification. That standard is the reason browsers treat line-through as a text decoration rather than a special effect.

How Do You Add CSS Cross Out Text?

You add CSS cross out text with text-decoration: line-through;. That is the baseline solution and the one you should use first unless you need semantic HTML or more advanced styling. It works on inline text, links, spans, and other text-bearing elements.

The basic CSS

.crossed {
  text-decoration: line-through;
}

That single rule is enough for most cases. The benefit of a reusable class is consistency. You can apply the same strike style anywhere in the interface instead of repeating inline styles across multiple components.

Why a reusable class is better than inline styles

  • Maintainability is better because one class can be updated globally.
  • Consistency improves when every crossed-out label looks the same.
  • Accessibility reviews are easier when the styling lives in one place.
  • Design systems can document the class as a standard pattern.

For example, a list item can be marked complete without changing the HTML structure much:

<li class="crossed">Submit quarterly report</li>

For pricing, the class can sit on the old price while the new price remains clear and prominent. That keeps the relationship obvious without forcing the user to guess which number is current.

Note

Use the strike only when the crossed-out text still deserves to be read. If the content should disappear entirely, remove it instead of striking it.

When Should You Use Del Versus S?

<del> is used for text that has been deleted or removed from a document or interface state. <s> is used for content that is no longer accurate or relevant but is still intentionally shown. The visual result can look similar, but the meaning is not the same.

That semantic difference matters because browsers, assistive technology, and future maintainers all benefit from accurate markup. If a sentence was removed during an edit, <del> is the stronger choice. If a product price or plan description is outdated but still shown for comparison, <s> often fits better.

Here is the practical rule: use <del> when the content itself has been removed from the current version, and use <s> when the content is still visible but no longer correct.

Use <del> when The content was removed from the current state of the page or document.
Use <s> when The content is outdated, incorrect, or no longer relevant, but you want to keep it visible.

This is also where the MDN <del> reference and MDN <s> reference are worth keeping close. They summarize how each element should be used in real documents, not just how they look on screen.

Semantic examples

  • Removed task detail: <del>Include printer setup instructions</del>
  • Outdated pricing: <s>$99</s> followed by the current price
  • Revised sentence: old wording struck through during editorial review

How Does Accessibility Change the Way You Use Strikethrough?

Accessibility is the reason strikethrough should be used carefully, not automatically. A line through text can communicate status visually, but it should not make the content hard to read or impossible to understand. If the meaning matters, the markup should support that meaning instead of relying on color alone.

The main accessibility rule is simple: the crossed-out text must remain legible. Avoid making it too light, too thin, or too low contrast, especially in small UI elements like tags, labels, and table rows. In dark mode, a strike that looks fine on white can become muddy or disappear entirely.

Screen readers also benefit from semantic HTML when the content has editorial or transactional meaning. A crossed-out price in a product card is often best paired with a clear visible current price nearby. That way, the status is obvious even if the decorative line is not perceived in the same way by all users.

Warning

Do not use strikethrough as the only signal that something changed if the change affects user decisions. Pair the visual style with clear wording, semantic HTML, or both.

For accessibility guidance, the WCAG contrast minimum guidance is the right reference point. It does not talk specifically about strikethrough, but it does define the contrast expectations that make text readable in real interfaces.

Readability checks that catch most problems

  • Test light mode and dark mode to confirm the strike remains visible.
  • Check small text because fine lines can disappear at smaller sizes.
  • Review on mobile where text wraps and spacing changes.
  • Compare contrast levels against adjacent text and UI chrome.

What Are the Best Ways To Style Strikethrough Beyond The Default?

The default strike is useful, but it is not the only option. Modern CSS gives you more control through text-decoration-color, text-decoration-thickness, and text-decoration-style. Those properties let you tune the appearance without abandoning the semantic idea of crossed-out text.

text-decoration-color separates the line color from the text color. That is helpful when the text needs to stay readable but the strike needs to be more subtle or more intentional. A muted red strike can imply removal, while a gray strike can blend into a neutral interface.

text-decoration-thickness changes how heavy the strike feels. Thin lines work better for dense dashboards. Thicker lines can work better for promotional graphics where the strike needs to hold its own visually.

Example with refined styling

.crossed-subtle {
  text-decoration-line: line-through;
  text-decoration-color: #9ca3af;
  text-decoration-thickness: 2px;
}

text-decoration-style can also alter the feel of the line, although solid is the most common choice. Dotted or wavy styles should be used sparingly because they can reduce clarity if the meaning is status rather than decoration.

The key is balance. Visual control should improve clarity, not turn the strike into a design gimmick. If users have to stop and interpret the line, the implementation is too clever.

A good strikethrough disappears into the reading experience until the user needs the status change it represents.

Can You Create More Creative Strikethrough Effects?

Yes, you can create more creative crossed text CSS effects with pseudo-elements and transforms when the default line-through is not flexible enough. This is useful for stylized product cards, promotional banners, and custom UI components where the strike needs to be angled, offset, or visually integrated with the design.

The most common advanced approach uses a pseudo-element to draw the line manually. That gives you control over placement, angle, thickness, and color. It also lets you create an oblique strike that feels more deliberate than the browser default.

Example with a pseudo-element

.crossed-custom {
  position: relative;
  display: inline-block;
}

.crossed-custom::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 2px solid currentColor;
  transform: rotate(-8deg);
  transform-origin: center;
}

That pattern is useful when you need a diagonal slash or a more branded look. It is also common when the strike must pass through mixed font sizes or sit on top of complex backgrounds. Still, the tradeoff is real: custom effects can be harder to maintain and can be less predictable across browsers and zoom levels.

Use creative effects only when the interface truly needs them. If your goal is simply to show that something is obsolete, the built-in line-through is usually the better choice.

When creative effects make sense

  • Promotional pricing cards where visual emphasis matters.
  • Custom dashboards with branded UI treatments.
  • Editorial mockups where the strike is part of a visual system.

How Is CSS Cross Out Text Used In Real Products?

CSS cross out text shows up in task managers, ecommerce stores, content editors, and configuration screens because it preserves context while showing change. The same pattern solves different problems in each environment, but the user benefit is always similar: the original text stays visible long enough to be useful.

In task apps, a completed item can remain in the list with a line through it. That helps the user verify completion without losing the original sequence of work. In product interfaces, an old price can be struck through while the discounted price sits beside it, making the value proposition instantly obvious.

In editorial workflows, strikethrough is often a temporary review tool. Writers and editors can mark deleted phrasing while retaining a visible comparison. That makes revisions easier to audit and reduces confusion when multiple people are reviewing the same copy.

In settings pages, deprecated options can remain visible but clearly inactive. That approach is especially useful when users need to understand what changed after an upgrade or product migration.

Examples by scenario

  • Task managers: completed checklist items remain in place.
  • Ecommerce: sale pricing pairs an old and new value.
  • Content systems: revision history stays readable.
  • Settings panels: deprecated features remain visible for reference.

For interface behavior and component guidance, the Nielsen Norman Group guidance on visual indicators is useful because it reinforces the broader UX principle: status cues should be obvious, not ambiguous.

What Mistakes Should You Avoid With Strikethrough?

The biggest mistake is using strikethrough for emphasis when it does not mean removed, outdated, or completed. If a design uses the line just because it looks interesting, users lose trust in the signal. A crossed-out word should mean something specific every time it appears.

Another common issue is overuse. If half the page is struck through, the visual language stops working. The effect becomes noise instead of a status marker, and the real changes are harder to notice.

Weak contrast is also a problem. A thin gray line on a slightly darker gray label may look elegant in a design file but vanish on a real screen. That is especially true in responsive layouts where font sizes, line height, and wrapping change unexpectedly.

Mistakes that show up in production

  • Decorative misuse: using strike-through as a style choice instead of a meaning cue.
  • Overuse: striking too much text so nothing stands out.
  • Poor contrast: making the line too faint to see.
  • Semantic confusion: choosing the wrong HTML element for the meaning.
  • Responsive breakage: the strike misaligns after wrapping or resizing.

When you want broader guidance on preserving meaning in web content, the W3C Web Content Accessibility Guidelines are the right standard to reference. They do not prescribe your exact strike style, but they do shape how clear and perceivable the result should be.

How Do You Choose The Right Approach For A Design System?

The right approach depends on whether the text needs visual styling only or semantic meaning too. If the strike is just for a temporary UI effect, a utility class may be enough. If the text has editorial, transactional, or audit significance, your design system should define when to use <del>, <s>, or a custom component.

A strong design system removes guesswork. Designers should know which status calls for a strike, how prominent it should be, and whether the line should use a fixed color or inherit from the surrounding text. Developers should know whether the component needs semantic HTML, helper text, or a live update pattern.

Standardization is important because the same visual treatment can mean different things in different contexts. A struck price is not the same as a struck paragraph. One is a comparison cue. The other may be part of an edit trail.

  1. Define meaning first. Decide whether the text is removed, outdated, completed, or purely decorative.
  2. Choose the correct HTML. Use semantic elements when the meaning matters.
  3. Pick a shared style. Set the color, thickness, and spacing rules in the design system.
  4. Document examples. Show approved use cases and prohibited misuse.
  5. Review in components. Test the strike in buttons, lists, tables, cards, and forms.

For teams building system-wide consistency, the NIST approach to structured guidance is a useful model even outside security. Clear standards reduce inconsistency, and inconsistency is what makes UI signals harder to trust.

How Do You Test And Verify CSS Cross Out Text?

You verify CSS cross out text by checking that the strike appears, the meaning is clear, and the layout still holds up in real conditions. A successful implementation is not just one that renders. It is one that communicates the right status without breaking readability or accessibility.

Start with browser testing. Open the page in at least two major browsers and confirm that the strike sits in the right position and matches the expected thickness. Then test at different zoom levels, because text decoration can look different once the user zooms the page or changes display scaling.

Verification checklist

  1. Confirm visual appearance. Check that the line-through is visible and aligned with the text.
  2. Check the semantic element. Make sure <del> or <s> matches the meaning.
  3. Inspect contrast. Verify the strike and text remain readable in light and dark themes.
  4. Test responsive layouts. Look for wrapping issues, clipping, or spacing collisions.
  5. Check assistive technology behavior. Confirm the content still makes sense when read aloud.
  6. Review real UI states. Test the strike inside lists, cards, labels, and tables.

Common failure symptoms include a strike that disappears on smaller screens, a line that overlaps adjacent text, or a style that looks correct in a mockup but becomes unreadable in production. Those issues are usually caused by over-tuned thickness, low contrast, or the wrong element choice.

Key Takeaway

CSS cross out text works best when it communicates status, not decoration. Use text-decoration: line-through; for the basic effect, use <del> or <s> when meaning matters, and refine with color and thickness only after readability is solid. The best implementations keep context visible, preserve trust, and remain easy to scan on any device.

Conclusion

CSS cross out text is simple to apply and easy to misuse. The best results come from treating it as a status signal first and a style second. When the text still matters, the strike gives users context without forcing them to lose the original information.

Start with the default line-through, then decide whether semantic HTML is needed. Use <del> for removed content and <s> for outdated content that remains visible. After that, tune the line for readability, not spectacle.

If you are building interfaces for task tracking, ecommerce, editorial workflows, or settings screens, use strikethrough intentionally and consistently. That is the difference between a clean UI and a confusing one.

For more practical front-end guidance like this, ITU Online IT Training focuses on patterns that are useful in real projects, not just in demos. The rule here is straightforward: make the status obvious, keep the text readable, and let the user understand what changed at a glance.

W3C, MDN, and NIST are referenced for technical guidance and accessibility context.

[ FAQ ]

Frequently Asked Questions.

What is the best CSS property to create a strikethrough effect on text?

The most common CSS property to create a strikethrough effect is text-decoration: line-through;. This property visually crosses out the text by rendering a horizontal line through its center, effectively signaling that the content is no longer relevant or has been completed.

While text-decoration: line-through; is simple and widely supported, it’s important to choose the right method based on context. For example, semantic HTML elements like <del> and <s> convey meaning in addition to style, which can improve accessibility and SEO. Combining semantic HTML with CSS ensures both visual clarity and meaningful markup.

How does using semantic HTML tags like <del> improve strikethrough text accessibility?

Using semantic tags like <del> to indicate deleted or removed text provides more than just a visual cue; it adds meaning for assistive technologies such as screen readers. These tags inform users that the text has been intentionally marked as deleted or outdated.

Screen readers can announce the change appropriately, making your content more understandable to users with disabilities. Additionally, semantic markup helps search engines interpret content changes correctly, which can benefit SEO. Therefore, combining <del> with CSS styling for strikethrough is a best practice for accessible and meaningful web content.

Can strikethrough text be used effectively in ecommerce pricing?

Yes, strikethrough text is commonly used in ecommerce to show discounted prices or promotional offers. By crossing out the original price with a line-through, you visually communicate to customers that a better deal is available.

Best practices include pairing the strikethrough original price with a clearly visible discounted price and ensuring color contrast is adequate for readability. Avoid overusing strikethroughs, as too many can confuse users or reduce the perceived value of offers. When implemented thoughtfully, CSS strikethrough enhances user experience and can boost sales.

What are common mistakes to avoid when applying CSS strikethrough?

One common mistake is using strikethrough to hide important information without explanation, which can confuse or frustrate users. Strikethrough should indicate revision, completion, or removal while keeping the original context clear.

Another pitfall is relying solely on visual styling without semantic markup, which hurts accessibility. Additionally, applying strikethrough to large blocks of text or important navigation elements can reduce readability and usability. Always consider the meaning and user impact before applying strikethrough styles.

How can I customize the appearance of strikethrough lines with CSS?

While the default text-decoration: line-through; is straightforward, CSS allows customization of the strikethrough effect for more stylistic control. For example, you can use the text-decoration-thickness, text-decoration-color, and text-decoration-style properties to adjust the line’s weight, color, and pattern.

For more advanced effects, CSS pseudo-elements like ::before or ::after combined with position and transform properties enable you to create custom cross-out lines that differ in angle or shape. These techniques provide flexibility to match your website’s design while maintaining clarity.

Related Articles

Ready to start learning? Individual Plans →Team Plans →
Discover More, Learn More
Code in SQL : A Comprehensive List of Commands and Statements Learn essential SQL commands and statements to efficiently manipulate and manage data… ChatGPT Image Input: An In-Depth Guide Discover how to effectively upload images and craft prompts for ChatGPT to… ChatGPT Prompt Engineering Discover how to craft effective prompts that enhance ChatGPT's responses, ensuring clearer,… Demystifying Microsoft Network Adapter Multiplexor Protocol Understand Microsoft Network Adapter Multiplexor Protocol and learn how NIC Teaming enhances… Amazon EC2 Hpc6id Instances - The Solution for HPC Workloads Discover how Amazon EC2 Hpc6id instances enhance HPC workloads with fast compute… ping Command - Practical Uses and Information Provided Discover how to use the ping command for network troubleshooting, performance analysis,…
FREE COURSE OFFERS