Class Header


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

The header element represents introductory content for its nearest ancestor sectioning content or sectioning root element. It is used to contain introductory content such as headings, navigation, logos, or other introductory elements. The header element can contain any flow content and is typically used at the top of a page, article, or section to provide context and navigation.

Examples:

import static org.apache.juneau.bean.html5.HtmlBuilder.*; // Simple page header Header simple = header( h1("My Website"), p("Welcome to our site") ); // Header with navigation Header withNav = header( h1("Company Name"), nav( ul( li(a("/home").children("Home")), li(a("/about").children("About")), li(a("/contact").children("Contact")) ) ) ); // Header with styling Header styled = header( h1("Styled Header"), p("A beautifully styled header") )._class("page-header"); // Header with logo and navigation Header withLogo = header( img("/logo.png", "Company Logo"), h1("Company Name"), nav( ul( li(a("/products").children("Products")), li(a("/services").children("Services")) ) ) ); // Header with ID Header withId = header( h1("Main Header"), p("This is the main header of the page") ).id("main-header"); // Header with styling Header styled2 = header( h1("Dark Header"), p("A header with dark styling") ).style("background-color: #333; color: white; padding: 20px;"); // Header with multiple sections Header multiSection = header( div()._class("header-top").children( p("Call us: (555) 123-4567"), p("Email: info@company.com") ), div()._class("header-main").children( h1("Company Name"), p("Your trusted partner") ) );

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

See Also: