Class Section


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

The section element represents a generic section of a document or application. It is used to group related content together and create a logical structure within a document. The section element should have a heading (h1-h6) to identify the section's topic and is typically used to divide content into thematic groups. It is important for creating accessible document structure and helps screen readers understand the organization of content.

Examples:

// Simple section Section simple = section( h2("Introduction"), p("This is the introduction section.") ); // Section with styling Section styled = section( h2("Features"), p("Here are the key features of our product.") )._class("content-section"); // Section with complex content Section complex = section( h2("Getting Started"), p("Follow these steps to get started:"), ol( li("Step 1: Install the software"), li("Step 2: Configure settings"), li("Step 3: Start using the application") ) ); // Section with ID Section withId = section( h2("Main Content"), p("This is the main content section.") ).id("main-content"); // Section with styling Section styled2 = section( h2("Styled Section"), p("This section has custom styling.") ).style("background-color: #f9f9f9; padding: 20px; margin: 10px 0;"); // Section with multiple elements Section multiple = section( h2("Documentation"), p("This section contains documentation."), ul( li("API Reference"), li("User Guide"), li("Examples") ), footer("Last updated: January 2024") ); // Section with article Section withArticle = section( h2("Latest News"), article( h3("News Article Title"), p("Article content goes here.") ) );

See Also: