<s>: The Strikethrough element #
::: section-content
The <s>
HTML element renders text with a strikethrough, or
a line through it. Use the <s>
element to represent things that are no
longer relevant or no longer accurate. However, <s>
is not appropriate
when indicating document edits; for that, use the
<del>
and
<ins>
elements, as appropriate.
:::
Try it #
::: section-content ::: iframe ::: {.output-header .border-rounded-top}
HTML Demo: <s> #
Reset :::
::: {#warning-no-script .warning-container} ::: warning The interactive example cannot be shown because JavaScript is disabled. ::: :::
::: {#warning-mathml-not-supported .warning-container .hidden} ::: warning The interactive example cannot be shown because MathML is not supported by your browser. ::: :::
::: {#editor-container .editor-container .tabbed-shorter .hidden .border-rounded-bottom editor-type=“tabbed”} ::: {#tab-container .section .tabs} ::: {#tablist .tab-list role=“tablist”} HTML
CSS
JavaScript :::
::: {#html-panel .section .hidden tabindex=“0” role=“tabpanel” aria-labelledby=“html” aria-hidden=“true”} ::: {#html-editor}
There will be a few tickets available at the box office tonight.
<p>SOLD OUT!</p>
::: :::
::: {#css-panel .section .hidden tabindex=“0” role=“tabpanel” aria-labelledby=“css” aria-hidden=“true”} ::: {#css-editor} /* stylelint-disable-next-line block-no-empty */ s { } ::: :::
::: {#js-panel .section .hidden tabindex=“0” role=“tabpanel” aria-labelledby=“js” aria-hidden=“true”} ::: {#js-editor} ::: ::: :::
::: {#output .output-container}
Output #
::: :::
::: {.section .console-container .hidden aria-hidden=“true”}
Console Output #
![] clear console
::: {#console .console} ::: :::
::: {#html-output .output .editor-tabbed} %html-content% ::: :::
Content categories | Phrasing content, flow content. |
---|---|
Permitted content | Phrasing content. |
Tag omission | None, both the starting and ending tag are mandatory. |
Permitted parents | Any element that accepts phrasing content. |
Implicit ARIA role | deletion |
Permitted ARIA roles | Any |
DOM interface | HTMLElement |
Attributes #
::: section-content This element only includes the global attributes. :::
Examples #
::: section-content ::: code-example [css]{.language-name}
.sold-out {
text-decoration: line-through;
}
:::
::: code-example [html]{.language-name}
<s>Today's Special: Salmon</s> SOLD OUT<br />
<span class="sold-out">Today's Special: Salmon</span> SOLD OUT
::: :::
Result #
::: section-content ::: {#sect1 .code-example} ::: iframe ::: ::: :::
Accessibility concerns #
::: section-content
The presence of the s
element is not announced by most screen reading
technology in its default configuration. It can be made to be announced
by using the CSS
content
property, along with the
::before
and
::after
pseudo-elements.
::: code-example [css]{.language-name}
s::before,
s::after {
clip-path: inset(100%);
clip: rect(1px, 1px, 1px, 1px);
height: 1px;
overflow: hidden;
position: absolute;
white-space: nowrap;
width: 1px;
}
s::before {
content: " [start of stricken text] ";
}
s::after {
content: " [end of stricken text] ";
}
:::
Some people who use screen readers deliberately disable announcing content that creates extra verbosity. Because of this, it is important to not abuse this technique and only apply it in situations where not knowing content has been struck out would adversely affect understanding.
- Short note on making your mark (more accessible) | The Paciello Group{target="_blank"}
- Tweaking Text Level Styles | Adrian Roselli{target="_blank"} :::
Specifications #
::: _table #
Specification #
HTML Standard
[#
the-s-element]{.small}
:::
Browser compatibility #
::: _table #
Desktop Mobile
Chrome Edge Firefox Internet Opera Safari WebView Chrome Firefox Opera Safari Samsung
Explorer Android Android for Android on IOS Internet
Android
s
1 12 1 Yes 15 ≤4 4.4 18 4 14 ≤3.2 1.0
Before Firefox 4,
this element
implemented the
`HTMLSpanElement`
interface instead
of the standard
`HTMLElement`
interface.
:::
See also #
::: section-content
- The
<strike>
element, alter ego of the<s>
{aria-current=“page”} element, is obsolete and should not be used on websites anymore. - The
<del>
element is to be used instead if the data has been deleted. - The CSS
text-decoration-line
property is to be used to achieve the former visual aspect of the<s>
{aria-current=“page”} element. :::
::: _attribution
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5
or later.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/s{._attribution-link}
:::