Display strikethrough text in HTML


Strikethrough text means line through text, <strike> tag helps us to cut line in the text. This tag is not supported in HTML5; it was used when everyone working on HTML4. Now instead of <strike> tag <del> tag is using in HTML5 to define deleted text.

Syntax

Following is the usage of strikethrough tag in HTML −

<strike>text…. </strike>

Example

In the following example we are trying to display a strike through a text using the <strike> tag –

<!DOCTYPE html>
<html>
<body>
   <h2>TutorialsPoint</h2>
   <p>Its an Edutech Company handles all Technical <strike>Non-Technical</strike> Subjects </p>
</body>
</html>

Example

In this example we are trying to achieve the strike through task using the <del> tag −

<!DOCTYPE html>
<html>
<head>
   <style>
      del {
         color: red;
      }
   </style>
</head>
<body>
   <h1>My World</h1>
   <h2>
      I Like Blue , <del>Red</del>, Pink colors
   </h2>
</body>
</html>

Example

We can also use <ins> tag to highlight by underlining the text. Following example demonstrate the usage of <ins> tag in HTML

<!DOCTYPE html>
<html>
<head>
   <style>
      h1 {
         color: red;
      }
   </style>
</head>
<body>
   <h1>My World</h1>
   <h2>
      I Like Orange , <del>blue</del>
      <ins>red</ins>, Pink colors!
   </h2>
</body>
</html>

Example

Following is another example, to know about markup text which is no longer correct −

<!DOCTYPE html>
<html>
<head>
   <style>
      h1{
         color: red;
      }
   </style>
</head>
<body>
   <h1>My World</h1>
   <h2><s>I Like red, black colors!</s></h2>
   <h2>But Everyone likes Pleasant colors</h2>
</body>
</html>

Updated on: 10-Oct-2023

545 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements