Class Main<T extends Main<T>>


public class Main<T extends Main<T>> extends StyledContainerElement<T>
Represents the HTML <main> element for the dominant content of the document.

The Main class provides a Java representation of the HTML5 main element, which specifies the main content of the document. There should be only one main element per page, and it should not be nested within article, aside, footer, header, or nav elements.

Features:

  • Semantic HTML5 structural element
  • Identifies primary page content
  • Improved accessibility with skip-to-main functionality
  • Better SEO through semantic markup
  • Only one per document (unique)
  • Full CSS styling capabilities

Usage Example:


 // Create the main content area
 Main mainContent = new Main();
 mainContent.setId("main-content");
 mainContent.addElement(new H1("Welcome"));
 mainContent.addElement(new P("This is the main content..."));

 // Create main with sections
 Main pageMain = new Main();
 pageMain.setClass("container");
 Section intro = new Section();
 intro.addElement(new H2("Introduction"));
 pageMain.addElement(intro);
 Section features = new Section();
 features.addElement(new H2("Features"));
 pageMain.addElement(features);

 // Typical page structure
 Header header = new Header();
 Main main = new Main();
 Footer footer = new Footer();
 // main contains the primary page content
 
Since:
2016
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • Main

      public Main()
      Creates a new Main element representing the dominant content of the document.