HTML5 introduced new elements and attributes that provide better structure and semantics to web documents. These elements help in creating more meaningful, accessible, and SEO-friendly content.
The declaration defines the document type and version of HTML. It should be the first line in an HTML document.
<!DOCTYPE html> # Declares the document type as HTML5
<html>
The<html>
element is the root element of an HTML document. It contains all other HTML elements.
<html lang="en"> # Root element with language attribute
<head>
The<head>
element contains meta-information about the document, such as the title, character set, and linked stylesheets.
<head>
<meta charset="UTF-8"> # Character encoding
<title>Document Title</title> # Title of the document
<link rel="stylesheet" href="styles.css"> # Link to an external stylesheet
</head>
<body>
The<body>
element contains the content of the document, such as text, images, and other media.
<body>
<h1>Main Heading</h1> # Main heading of the page
<p>This is a paragraph.</p> # A paragraph of text
</body>
<header>
The<header>
element represents introductory content or a set of navigational links. It is typically used for headings and site navigation.
<header>
<h1>Website Title</h1>
<nav>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
</ul>
</nav>
</header>
<nav>
The<nav>
element defines a section of navigation links.
<nav>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#services">Services</a></li>
</ul>
</nav>
<main>
The<main>
element represents the dominant content of the<body>
of a document. It is used for the main content unique to the page.
<main>
<h2>Main Content Heading</h2>
<p>Main content goes here.</p>
</main>
<section>
The<section>
element represents a thematic grouping of content. It can be used to divide a page into distinct sections.
<section>
<h2>Section Title</h2>
<p>Content of the section.</p>
</section>
<article>
The<article>
element represents a self-contained piece of content that could be distributed independently.
<article>
<h2>Article Title</h2>
<p>Article content goes here.</p>
</article>
<aside>
The<aside>
element represents content that is tangentially related to the content around it. It is often used for sidebars or additional information.
<aside>
<h3>Related Information</h3>
<p>Some additional content or links.</p>
</aside>
<footer>
The<footer>
element represents the footer of a section or page. It typically contains copyright information, contact links, or other metadata.
<footer>
<p>© 2024 Company Name. All rights reserved.</p>
</footer>
<figure>
The<figure>
element represents any content that is referenced from the main content, such as images or diagrams, often accompanied by a<figcaption>
.
<figure>
<img src="image.jpg" alt="Description">
<figcaption>This is an image description.</figcaption>
</figure>
<figcaption>
The<figcaption>
element provides a caption or legend for a<figure>
element.
<figcaption>This is a caption for the figure.</figcaption>
<address>
The<address>
element is used to provide contact information for the author or owner of a document or article.
<address>
<p>Contact us at: info@example.com</p>
</address>
I think you are here to get to know me.
🌐 Connect with me across platforms.
🤝 Hit me up on these links, and let's turn ideas into action!