HTML5: How to define a header for a document or section?
Solution:
HTML Code:
Explanation:
- This HTML code represents a basic HTML document structure with a focus on the header element.
- The <html> element is the root element of the HTML document, and the lang attribute is set to "en" to specify the language as English.
- The <head> element contains meta-information about the HTML document, such as the character encoding and the title.
- Inside the <head> element, there is a <meta> tag specifying the description of the HTML document.
- The <body> element contains the visible content of the HTML document.
- Inside the <body> element, there is a <header> element, which typically contains introductory content or navigational links for the document or a section of the document.
- Within the <header> element, there is a <h1> (heading level 1) element representing the main heading of the section.
- Following the main heading, there is a paragraph (<p>) element providing additional information about the header element.
- This paragraph is followed by an unordered list (<ul>) containing list items (<li>) specifying different elements that may be included within a header, such as headings, groupings, table of contents, search forms, and logos.
Live Demo:
See the solution in the browser
Supported browser
![]() |
![]() |
![]() |
![]() |
![]() |
Yes | Yes | Yes | Yes | Yes |
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics