Class H2


@Bean(typeName="h2") public class H2 extends HtmlElementMixed
DTO for an HTML <h2> element.

The h2 element represents a second-level heading in a document or section. It is used to mark up subsections or secondary headings that are hierarchically below h1 elements. The h2 element is typically used to organize content into major sections and is important for creating a logical document structure. It is typically rendered in a smaller font size than h1 but larger than h3 elements.

Examples:

import static org.apache.juneau.bean.html5.HtmlBuilder.*; // Simple section heading H2 simple = h2("Getting Started"); // H2 with styling H2 styled = h2("Product Features") ._class("section-title"); // H2 with complex content H2 complex = h2( "Chapter 2: ", strong("Advanced Topics"), " ", em("(Expert Level)") ); // H2 with ID H2 withId = h2("Installation Guide") .id("installation"); // H2 with styling H2 styled2 = h2("Configuration Options") .style("color: #666; border-bottom: 2px solid #ccc; padding-bottom: 10px;"); // H2 with multiple elements H2 multiple = h2( "Section 2.1: ", span()._class("subsection").children("Basic Setup"), " ", small("(Required)") ); // H2 with links H2 withLinks = h2( "API Reference: ", a("/api/users").children("User Management"), " Endpoints" );

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

See Also:
  • Constructor Details

    • H2

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

      public H2(Object... children)
      Creates an H2 element with the specified child nodes.
      Parameters:
      children - The child nodes.
  • Method Details