In this article, we will know the HTML <strike> tag, along with understanding its implementation through the example. The <strike> tag defines a strike or line through Text. This tag creates a cut line in the text. This tag is depreciated from HTML 5. Now, the <del> tag is used instead of this tag.
Syntax:
<strike> Contents </strike>
Note: This tag is not supported in HTML5, instead of this tag, we can use HTML del Tag or HTML ins Tag or use CSS text-decoration property.
Example 1: In this example, we simply use a strike tag on the text Hi Geeks!
HTML
<!DOCTYPE html>
<html>
<body>
<!-- Strike Tag -->
<h2>
Welcome To GeeksforGeeks
</h2>
<strike>
Hi Geeks!
</strike>
</body>
</html>
Output:
HTML tag
Example 2: Below example illustrates the <strike> tag in HTML.
HTML
<!DOCTYPE html>
<html>
<body>
<h1>
Welcome to GeeksforGeeks
</h1>
<h2>
strike Tag
</h2>
<!-- Html strike tag -->
<strike>
GeeksforGeeks
</strike>
</body>
</html>
Output:
HTML Tag
Supported Browsers:
HTML <strike> Tag – FAQs
Is the <strike> tag still supported in HTML5?
No, the <strike> tag is deprecated in HTML5 and has been replaced by the <s> tag. The <s> tag should now be used to indicate text that is no longer accurate or relevant.
What is the difference between the <strike> and <s> tags?
The <strike> tag was the original method for striking through text but has been deprecated. The <s> tag is the modern replacement in HTML5, and it carries the same function of showing text with a strikethrough effect.
Can the <strike> tag still be used in modern browsers?
Although the <strike> tag is deprecated, many modern browsers still support it for backward compatibility. However, it is not recommended for use in new projects.
What are the alternatives to the <strike> tag?
The preferred alternative is the <s> tag, which provides the same functionality in a more modern and semantically correct way. Additionally, the text-decoration: line-through; CSS property can be used to apply a strikethrough effect.
Why was the <strike> tag deprecated?
The <strike> tag was deprecated because it is not semantically meaningful. HTML5 promotes the separation of content structure and presentation, so the <s> tag, which is semantically appropriate for text that is no longer correct or relevant, was introduced as a replacement.