Class S<T extends S<T>>

Direct Known Subclasses:
Strike

public class S<T extends S<T>> extends PhrasingContentElement<T>
Represents an HTML <s> (strikethrough) element that displays text with a line through it.

The <s> element renders text with a strikethrough line, indicating that the content is no longer accurate or relevant. This is commonly used for showing price reductions, outdated information, or deleted content. For text that has been deleted in document editing contexts, consider using the <del> element instead, which has semantic meaning for tracking changes.

Features:

  • Displays text with a horizontal line through it
  • Indicates content that is no longer accurate or relevant
  • Commonly used for showing price reductions or corrections
  • Inline element that doesn't break text flow
  • Supports text content and nested HTML elements
  • Visual-only semantics (use <del> for editing semantics)

Usage:


 // Price reduction
 Paragraph price = new Paragraph();
 S oldPrice = new S("$99.99");
 price.addElement(oldPrice);
 price.addText(" Now only $49.99!");

 // Outdated information
 Paragraph info = new Paragraph();
 info.addText("Office hours: ");
 S old = new S("9 AM - 5 PM");
 info.addElement(old);
 info.addText(" Updated: 8 AM - 6 PM");

 // Constructor with text
 S incorrect = new S("This information is no longer valid");

 // Empty for dynamic content
 S dynamic = new S();
 dynamic.addText("Dynamically added strikethrough text");
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • S

      public S()
      Constructs a new empty S element.

      Creates an HTML <s> element with no initial content. Text can be added later using the inherited text methods.

    • S

      public S(String text)
      Constructs a new S element with the specified text.

      Creates an HTML <s> element containing the specified text, which will be displayed with a strikethrough line.

      Parameters:
      text - the text to display with strikethrough