<strike> Tag In Html

In this post, we will focus on Tag <strike> with examples, expecting it to provide the necessary educational content.

The <strike> tag is an HTML element that is used to indicate that text should be struck through, or shown as if it has been deleted. When the <strike> tag is used, the text within the tag will be rendered with a line through the middle of it.



Why was HTML Strike Tag Deprecated ?

The HTML <strike> tag has been deprecated in HTML5 because it is considered to be a presentational element, meaning that it is used solely for styling purposes and does not provide any semantic meaning to the content.

In modern web development, there is a strong emphasis on separating content from presentation, and using presentational elements like <strike> can make it more difficult to maintain and update web pages over time. Additionally, presentational elements can make it harder for assistive technologies like screen readers to interpret and convey the content to users with disabilities.

In place of the <strike> tag, HTML5 recommends the use of the <s> tag or the <del> tag to indicate that text has been struck through. These tags are considered to be more semantic and provide additional information about the meaning and purpose of the content they contain.

The <s> tag is used to indicate that content is no longer accurate or relevant, while the <del> tag is used to indicate that content has been deleted or removed. By using these tags instead of <strike>, web developers can create more accessible and maintainable web pages that are easier to understand and update.


Tag <strike> Uses

Here are some common use cases for the <strike> tag:

When content has been removed from a web page, the <strike> tag can be used to indicate that it was deleted. This can be useful for indicating that content has been updated or revised.

If content on a web page is no longer accurate or relevant, the <strike> tag can be used to indicate that it is outdated. This can be useful for preventing users from relying on outdated information.

In some cases, the <strike> tag can be used to emphasize negative content. For example, it could be used to indicate that a product or service is no longer available, or to draw attention to a negative review or comment.


Tag <strike> Substitution

Implement the <del> tag to define deleted text:

Example: 

<!DOCTYPE html> <html> <body> <p>My favorite dish is <del>Steak</del> <ins>Sushi</ins>!</p> </body> </html>

If you would like to mark up text that has changed, include the <s> tag:

Example: 

<!DOCTYPE html> <html> <body> <p>It was previously thought that <s>plants do not have the ability to feel pain</s> , but recent studies have shown otherwise.</p> </body> </html>

CSS can also be applied to the <del> and <s> tag as well:

Example: 

<!DOCTYPE html> <html> <head> <style> del{ color: maroon; font-size: 15px; } s{ color: blue; font-size: 12px; } </style> </head> <body> <p>My favorite dish is <del>Steak</del> <ins>Sushi</ins>!</p> <p>It was previously thought that <s>plants do not have the ability to feel pain</s> , but recent studies have shown otherwise.</p> </body> </html>

<del> vs <strike> Tag

The <del> and <strike> tags are both used to indicate that text should be displayed with a line through the middle of it. However, there are some key differences between the two tags that are important to consider when choosing which one to use.

  • The <del> tag is used to indicate that content has been deleted or removed, while the <strike> tag does not provide any specific semantic meaning. This means that using the <del> tag can provide more context about the purpose of the struck-through text.
  • The <del> tag is recommended by the mrexamples Web Content Accessibility Guidelines (WCAG) for indicating deleted content in a way that is more accessible to users with disabilities. This is because the <del> tag has a specific semantic meaning that can be conveyed to users with screen readers, while the <strike> tag does not.
  • The <strike> tag has been deprecated in HTML5, meaning that it is no longer recommended for use in new web development projects. Instead, the HTML5 specification recommends using the <s> tag or the <del> tag to achieve the same effect.
Provide us with your feedback on this site by leaving a reaction below.
We value your feedback.
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0

Subscribe To Our Newsletter
Enter your email to receive a weekly round-up of our best posts. Learn more!
icon

Leave a Reply

Your email address will not be published. Required fields are marked *