The <s>
tag in HTML is used to indicate strikethrough text, which visually represents text that has been crossed out or is no longer relevant. It is a presentation tag that shows text with a line through it, suggesting that the text has been removed or is obsolete.
<s>
tag applies a line through the text, making it appear crossed out.<p>This is an <s>obsolete</s> term.</p>
In this example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Strikethrough Example</title>
</head>
<body>
<p>The price was <s>$99.99</s> but is now $79.99.</p>
<p>Please disregard the <s>previous instructions</s>; the new instructions are available.</p>
</body>
</html>
In this example:
<s>
tag is used to show that the price "$99.99" is no longer valid.While the <s>
tag is still valid and functional, its use has been largely superseded by the <del>
tag (for deleted content) and <ins>
tag (for inserted content), which are more semantically appropriate for indicating changes in content. The <s>
tag is more commonly used for stylistic purposes rather than semantic changes.
You can style the <s>
element using CSS to modify its appearance if needed.
s {
text-decoration: line-through;
color: #999; /* Optional: change the color of the strikethrough text */
}
In this example:
text-decoration: line-through;
property ensures the text is displayed with a line through it.<s>
tag is used to show text with a strikethrough effect, indicating it is no longer relevant or has been removed.<del>
for semantic purposes when indicating deleted content.In summary, the <s>
tag is used to display text with a strikethrough line, indicating that the text is no longer applicable or has been removed. While it is still valid, its usage is less common in favor of more semantically appropriate elements like <del>
and <ins>
@aCodeTutorials All Rights Reserved
privacy policy | about