What is HTML <s> Tag?
The HTML s tag is used to show text that is no longer correct, relevant, or accurate. It displays text with a strikethrough line, visually indicating that the information is outdated or replaced by newer content. This tag is mainly used for marking text that should be read but not considered current. For example, old prices, incorrect data, or replaced information on a webpage can be wrapped inside the s tag. It is important for web design because it provides a clear visual clue to users about content changes while keeping the text visible for reference.
Syntax of the HTML <s> Tag
<s>Your text here</s>
The s tag starts with the opening tag <s> and ends with the closing tag </s>. The text between these tags appears with a line through it in browsers.
Examples of HTML <s> Tag
Example 1: Basic HTML s Tag
<!DOCTYPE html>
<html lang="en">
<body>
<p>Old Price: <s>$50</s> New Price: $35</p>
</body>
</html>
In this example, the HTML s tag is used to strike through the old price of $50, showing that it has been replaced by a new price of $35. This is a common way to display discounts or updated prices on e-commerce websites.
Example 2: SEO-Optimized HTML s Tag
<!DOCTYPE html>
<html lang="en">
<body>
<h2>Exclusive Offer - Scholar247</h2>
<p>Limited-time deal: <s>Was $100</s> Now only $75 for premium courses at Scholar247.</p>
</body>
</html>
This example uses the s tag to show that the old price of $100 is no longer valid. It’s SEO-friendly because it keeps both the old and new values visible for users and search engines, making the content informative and transparent.
Attributes of the HTML <s> Tag
The HTML s tag does not support any specific attributes. It only accepts global HTML attributes such as:
• id — Assigns a unique ID to the element.
• class — Adds a class name for styling through CSS.
• style — Applies inline CSS styles.
• title — Provides extra information as a tooltip.
Best Practices for HTML <s> Tag
• Use the s tag only for text that is outdated or incorrect, not deleted.
• For deleted text in document revisions, prefer the del tag instead.
• Combine it with CSS for consistent design control.
• Avoid overusing the s tag, as too many strike-throughs can confuse readers.
• Keep the surrounding content clear to highlight the correction effectively.
FAQs About the HTML <s> Tag
Q1: What is the purpose of the HTML s tag?
The s tag is used to display text that is no longer correct or relevant by drawing a line through it.
Q2: Is the HTML s tag the same as the del tag?
No. The s tag shows text that’s incorrect or outdated, while the del tag indicates text that has been removed or deleted in document revisions.
Q3: Does the HTML s tag affect SEO?
Not directly. It helps maintain clarity for users, but it doesn’t influence search rankings. However, keeping outdated information visible can improve user trust.
Q4: Can I style the s tag with CSS?
Yes. You can change the line color, thickness, or style using CSS to match your website’s design.
Q5: Is the HTML s tag still supported in modern browsers?
Yes, all major browsers fully support the HTML s tag, and it remains valid in HTML5 for visual formatting purposes.