Structural Elements
Structural Elements
-
Division (
<div>): A versatile block-level container used to group other elements for styling or scripting purposes. Think of it as a generic container for organizing your page layout. -
Section (
<section>): Defines a thematic section within a document. Use<section>elements to group related content, like articles or blog posts. -
Article (
<article>): Represents a self-contained piece of content, like a news article or blog post. Articles can be reused independently of the surrounding content. -
Main (
<main>): The primary content of the document. The<main>element should only contain content that directly relates to the page’s central focus. -
Header (
<header>) and Footer (<footer>): Define the header and footer sections of a page, respectively. The<header>typically contains introductory content like logos and navigation, while the<footer>often holds copyright information or contact details.
Example:
<header> <h1>My Website</h1> <nav></nav></header><main> <section> <h2>Article 1</h2> <p>This is the content of the first article.</p> </section> <section> <h2>Article 2</h2> <p>This is the content of the second article.</p> </section></main><footer> <p>© 2024 My Website</p></footer>By understanding these core text and structural elements, you’ll be well on your way to building meaningful and well-organized web pages.