Updated March 27, 2023
Introduction to HTML Strike Tag
The html has a different set of tags for using the web pages built more attractive, and user-defined requirements have to be satisfied. Every version of the html has a different set of features that should be used, and some of them have deprecated from the older version to the newer version. The same thing <strike> is one of the tags in html it specifies through the strikethrough text in html web pages. Now, this tag is already deprecated; now <del> tag is used instead of the <strike> tag in html. Mainly in html5, this tag is not useable; instead, it supports <del>,<s>, or it will use CSS Styles in the document.
Syntax:
The strike tag has the following syntax that will be used in html web pages.
<html>
<body>
<strike>--content--</strike>
</body>
</html>
The above code is a basic syntax; it will use the user contents in the <strike> tag in the web pages. It will also use the global attributes in HTML, and also it uses the Event Attributes. In HTML, always the <strike> tag comes in pairs and the same general rule is applied always opening<strike> and closing </strike> tag must be used.
How to use Strike Tag in HTML?
- Whenever using a strike tag for creating strikethrough text in html, we can also use some CSS style decorations like “linethrough” in the <style> tag in Html.
- Although CSS is always great when compare through the other presentation frameworks for styling the contents in the web pages, it does not provide any exact meaning of the contents that’s why we use html semantic tags compared to CSS even much better than that both the <s> and <del> tags using strikethrough contents in html but both tags will convey the meanings in a different way.
- The<s> tag will be used if we want to represent the contents of something on the web page, but it is not accurate or relevant to that text anymore.
- In the html document or project requirements, we should not use it for editing the documents. If we want to remove some contents in the html document will use the <del> tag.
- The html <strike> tag always gives the text appearance through the text using horizontal lines in the center positions of the web pages. Strikethrough, which is primarily used in the mark text, is mistaken or it will be removed automatically using some other html tags like <del>.
- By default, in web pages, the text is in strike-through lines through which is in idle positions for showing corrections in the given texts. It will work equally in layouts like table format as well as other formats based upon the CSS styles.
- As with some phrases, it depends upon the html tags; it will combine with the situations where the user consistency is difficult to achieve in some other ways because we know that opening and closing tag is displayed in the strikethrough in the html text.
- The<strike> tag is possible for adding the styles with functionalities; these have to be done by after adding the attribute to after the opening <strike> tag.
- All the attributes are allowed for the strike tag as an included class, dir, ids, lang, title, and styles. But probably most cases classes and ids are used like <strike id=” sample”>some contents</strike>above all the attributes, we will note that there is a space after the strike tag contents initialized then the attribute names if we use any equal sign operators and the identifiers of the attributes using double-quotes.
- In CSS Styling, both class and id attributes are referred to as the elements like CSS, and also, it will be stored either in the <head> tag of the web page in an external file. By using id usually, it refers to the single instance of the web page, but if we use class attribute mainly, it refers to the repeating element on the web page for this purpose html <strike> tag use either in id or class attribute in html document.
- If we use any of these attributes, it will allow in the CSS style information that is data is allowed in the <strike> tag. In dir attributes of the html basically, it allows for reading the text both left and right side of the web pages, lang attributes allowed for specifying the languages for the tag in the web pages based on the user requirement if it needs more than 2 languages or multiple languages to allow in a web page these tags will be used.
- If we need the title content of the html page to use the <title> tag, it will allow the user to include some extra information in the html tags.
Examples of HTML Strike Tag
Given below are the examples of HTML Strike Tag.
Example #1
Code:
<html>
<body>
<p>Welcome <strike>To My Domain</strike> Thanks</p>
</body>
</html>
Output:
Example #2
Code:
<html>
<head>
<style>
.sample{
color:blue;
}
body {
text-align:center;
}
</style>
</head>
<body>
<div class="sample">
<strike>Welcome</strike>
<strike>To My Domain</strike>
</div>
</body>
</html>
Output:
Example #3
Code:
<html>
<head>
<style>
.sample{
color:red;
}
body {
text-align:center;
}
</style>
</head>
<body>
<div class="sample">
<ol>
<li>Apples</li>
<li><del>Mangoes</del></li>
<li><del>Strawberry</del></li>
</ol>
</div>
</body>
</html>
Output:
The above examples show the <strike> tag usages in HTML documents. We see the first example will use the <strike> tag in html document in that mentioned contents will be deprecated in the web page same second example we will use some CSS styles applied in the web pages based on that it will be displayed in the web page views on the user screen the final example we use the <del> tag in the document instead of <strike> tag same purpose the mentioned contents or text will be removed in the web page. The Same tag will be worked on some other frameworks like bootstrap and jquery libraries also; it will be used in the ionic Angular frameworks etc.
Conclusion
Based on the above concepts, the surface of the <strike> HTML tag will be easy to see how versatile it is in web page users. It will take full advantage of the understanding of CSS frameworks, and also it will work with jquery, Angular but the purpose will be different for each technologies.
Recommended Articles
This is a guide to HTML Strike Tag. Here we discuss the basic concept, various examples, and how to use strike tags in HTML? You may also have a look at the following articles to learn more –