Class Span


@Marshalled(typeName="span") public class Span extends HtmlElementMixed<Span>
DTO for an HTML <span> element.

The span element is a generic inline container for phrasing content. It has no inherent meaning and is typically used to group inline elements for styling purposes or to apply attributes to a portion of text. The span element is commonly used with CSS to apply styles to specific portions of text or to mark up text for JavaScript manipulation.

Examples:

import static org.apache.juneau.bean.html5.HtmlBuilder.*; // Text with highlighted portion Span highlight = span("This is highlighted text") .class_("highlight"); // Text with multiple styled portions Span styled = span( "Normal text ", span("bold text").class_("bold"), " and ", span("italic text").class_("italic") ); // Text with clickable portion Span clickable = span( "Click ", span("here").class_("link").onclick("showDetails()"), " for more information" ); // Text with tooltip Span tooltip = span("Hover over this text") .title("This is a tooltip"); // Text with language specification Span lang = span("Hola mundo") .lang("es");

See Also:
  • Constructor Details

    • Span

      public Span()
      Creates an empty Span element.
    • Span

      public Span(Object... children)
      Creates a Span element with the specified child nodes.
      Parameters:
      children - The child nodes. Must not be null.