HTML - <s> Tag



Introduction to <s> Tag

The HTML <s> tag is used to represent content that is no longer correct or accurate. It stands for strike-through tag and is useful for rendering text with a line through it.

It is recommended to use the <del> tag instead of the <s> tag to define deleted text in a document.

Syntax

Following is the syntax of <s> tag −

<s>.....</s>

Attributes

The HTML <s> tag supports Global and Event attributes.

Example: Basic Usage

In the following example, we create an HTML document and using the <s> tag to represent a word or sentence that is no longer correct. This HTML code demonstrates the <s>, striking through "Makes life difficult" to show it is no longer accurate.

<!DOCTYPE html>
<html>
<body>
   <h2>Example of <s> tag </h2>
   <p>
      <b>Tutorialspoint</b>
      <s> Makes life difficult </s> 
      Makes life easy! because Easy to learn
   </p>
</body>
</html>

Example: Styling Strike Line

Here, we use the paragraph but include CSS attributes to make it more stylish. This HTML code demonstrates the <s> tag, striking through the given data.

<!DOCTYPE html>
<html>
<head>
   <style>
      p {
         font-size: 20px;
         font-style: italic;
      }
   
      b {
         color: green;
      }
   
      span {
         color: black;
      }
   
      s {
         background-color: #F88379;
      }
   </style>
</head>
<body>
   <h2>Example of <s> tag </h2>
   <p>
      <b>tutorials <span>point</span>
      </b>
      <s> Makes life difficult</s> Simply Easy Learning
   </p>
</body>
</html>

Example: Striking Multiple Sentences

Let's look at the following example, we create an HTML document using the <s> tag to mark a line through text. This HTML code demonstrates the <s> tag, strikes through the given content.

<!DOCTYPE html>
<html>
<head>
   <style>
      s {
         background: red;
      }
   </style>
</head>
<body>
   <h2>The HTML s Tag</h2>
   <p>
      <s>Only 25 tickets left!</s>
   </p>
   <p>SOLD OUT!</p>
</body>
</html>

Supported Browsers

Tag Chrome Edge Firefox Safari Opera
s Yes Yes Yes Yes Yes
html_tags_reference.htm
Advertisements