Understanding HTML5 Semantic Elements for Aside, Footer, Main, Figure, and Figcaption

5. Aside <aside>:

The <aside> HTML element represents a portion of a document whose content is only indirectly related to the document's main content. Asides are frequently presented as sidebars or call-out boxes..

Example

<aside>
    <h3>Related Articles</h3>
    <!-- Related articles list -->
</aside>
        

6. Article:

The `<article>` element defines a self-contained piece of content, such as a blog post, forum post, or news article.

Example

<article>
    <h3>Article Title</h3>
    <p>Article content goes here...</p>
</article>
        

7. div <div> :

Example

<div>
    <!-- div content of the webpage -->
</div>
        

5. Main <main> :

The `<main>` element represents the main content of the document.

Example

<main>
    <!-- Main content of the webpage -->
</main>
        

9. Figure and Figcaption :

The <figure> element is used to encapsulate a media object, such as an image, video, or diagram. The `<figcaption>` element provides a caption for the media object.

Example

<figure>
    <img src="image.jpg" alt="Description of the image">
    <figcaption>Caption for the image</figcaption>
</figure>
        

Small Project: Product Showcase Using Semantic Elements

Let's create a simple product showcase webpage using HTML5 semantic elements.

Example

<main>
    <header>
        <h1>Featured Products</h1>
    </header>
    <section>
        <article>
            <h2>Product A</h2>
            <p>Description of Product A</p>
            <footer>
                <p>$20.00</p>
            </footer>
        </article>
        <article>
            <h2>Product B</h2>
            <p>Description of Product B</p>
            <footer>
                <p>$25.00</p>
            </footer>
        </article>
    </section>
    <aside>
        <h3>Related Products</h3>
        <!-- Related products list -->
    </aside>
</main>
<footer>
    <p>&copy; 2024 My Website. All rights reserved.</p>
</footer>
        

Conclusion:

HTML5 semantic elements offer a more descriptive way to structure web documents, improving both accessibility and maintainability. By understanding and utilizing these elements effectively, developers can create well-organized and semantically meaningful web pages. Incorporate semantic elements into your projects to enhance readability, accessibility, and search engine optimization. Happy coding!