Class H1


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

The h1 element represents the highest level heading in a document or section. It is used to mark up the main title or most important heading on a page. The h1 element should be used only once per page and should describe the main topic or purpose of the page. It is typically rendered in the largest font size among all heading elements and is important for both accessibility and SEO.

Examples:

import static org.apache.juneau.bean.html5.HtmlBuilder.*; // Simple page title H1 simple = h1("Welcome to Our Website"); // H1 with styling H1 styled = h1("About Our Company") ._class("page-title"); // H1 with complex content H1 complex = h1( "Welcome to ", strong("Our Company"), " - ", em("Innovation at its finest") ); // H1 with ID H1 withId = h1("Product Documentation") .id("main-title"); // H1 with styling H1 styled2 = h1("User Guide") .style("color: #333; text-align: center; margin-bottom: 30px;"); // H1 with multiple elements H1 multiple = h1( "Chapter 1: ", span()._class("chapter-title").children("Getting Started"), " ", small("(Beginner Level)") ); // H1 with links H1 withLinks = h1( "Product: ", a("/products/widget", "Amazing Widget"), " v2.0" );

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

See Also:
  • Constructor Details

    • H1

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

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