Class P


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

The p element represents a paragraph of text. It is one of the most commonly used HTML elements for structuring text content. Paragraphs are block-level elements that automatically add spacing before and after the content, making them ideal for organizing textual information into readable sections.

Examples:

// Simple paragraph P simple = p("This is a simple paragraph of text."); // Paragraph with styling P styled = p("This paragraph has custom styling.") .class_("lead"); // Paragraph with mixed content P mixed = p( "This paragraph contains ", strong("bold text"), " and ", em("italic text"), "." ); // Paragraph with link P withLink = p( "Visit our ", a("/help", "help page"), " for more information." ); // Paragraph with ID and class P withAttrs = p("Important notice") .id("notice") .class_("alert alert-warning"); // Paragraph with inline styles P withStyle = p("Styled paragraph") .style("color: blue; font-size: 16px;");

The following convenience methods are provided for constructing instances of this bean:

See Also:
  • Constructor Details

    • P

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

      public P(Object... children)
      Creates a P element with the specified child nodes.
      Parameters:
      children - The child nodes.