What is HTML?
HTML stands for HyperText Markup Language...
Home 〉 HTML Tutorials 〉 HTML Semantic Elements - Complete Guide with Examples & Syntax
HTML Semantic Elements - Complete Guide with Examples & Syntax !
Wondering how to give your HTML pages a meaningful and SEO-friendly structure? This detailed blog post on HTML semantic elements explains what semantic tags are, their usage, supported attributes, and examples with CSS styling. Each semantic tag like '<header>', '<nav>', '<article>', and '<footer>' is described clearly with syntax and examples. Styling tips and best practices are also included. The complete blog post on HTML Semantic Elements is as follows.
Semantic HTML elements clearly describe their meaning to both the browser and the developer. Unlike non-semantic elements like '<div>' and '<span>', semantic elements such as '<header>', '<footer>', '<article>', and '<section>' provide meaningful structure to web pages, improving accessibility and SEO.
Using semantic elements is considered a best practice in HTML5, as it helps search engines and screen readers understand the content of the webpage more effectively.
Semantic elements give content meaning. Here's a list of commonly used semantic elements in HTML:
Example:
<!DOCTYPE html>
<html>
<body>
<header style="background-color: #f2f2f2; padding: 10px;">
<h1>Welcome to My Tutorial Website</h1>
</header>
</body>
</html>
output 📌
You can Try the above code by changing the values in our user-friendly code editor by clicking the "Try It" button and see the output of the same.
Example:
<!DOCTYPE html>
<html>
<body>
<nav style="background-color: #ddd; padding: 8px;">
<a href="/html">HTML</a> |
<a href="/css">CSS</a>
</nav>
</body>
</html>
output 📌
You can Try the above code by changing the values in our user-friendly code editor by clicking the "Try It" button and see the output of the same.
Example:
<!DOCTYPE html>
<html>
<body>
<main style="margin: 15px;">
<h2>Main Content Area</h2>
<p>This is where your tutorial content goes.</p>
</main>
</body>
</html>
output 📌
This is where your tutorial content goes.
You can Try the above code by changing the values in our user-friendly code editor by clicking the "Try It" button and see the output of the same.
Element Type: Block-level
Example:
<!DOCTYPE html>
<html>
<body>
<section style="padding: 10px; border: 1px solid #ccc;">
<h3>HTML Basics</h3>
<p>Learn the basics of HTML step by step.</p>
</section>
</body>
</html>
output 📌
Learn the basics of HTML step by step.
You can Try the above code by changing the values in our user-friendly code editor by clicking the "Try It" button and see the output of the same.
Element Type: Block-level
Example:
<!DOCTYPE html>
<html>
<body>
<article style="background-color: #eef; padding: 10px; border-radius: 5px;">
<h4>What is HTML?</h4>
<p>HTML stands for HyperText Markup Language...</p>
</article>
</body>
</html>
output 📌
HTML stands for HyperText Markup Language...
You can Try the above code by changing the values in our user-friendly code editor by clicking the "Try It" button and see the output of the same.
Element Type: Block-level
Description: Contains content tangentially related to the main content.
Example:
<!DOCTYPE html>
<html>
<body>
<aside style="margin: 10px; background-color: #f9f9f9; padding: 8px;">
<h4>Tip:</h4>
<p>Use semantic tags for better SEO!</p>
</aside>
</body>
</html>
output 📌
You can Try the above code by changing the values in our user-friendly code editor by clicking the "Try It" button and see the output of the same.
Element Type: Block-level
Description: Represents footer for a section or page.
Example:
<!DOCTYPE html>
<html>
<body>
<footer style="text-align: center; background-color: #ccc; padding: 10px;">
</footer>
</body>
</html>
output 📌
You can Try the above code by changing the values in our user-friendly code editor by clicking the "Try It" button and see the output of the same.
Element Type: Block-level
Yes! Semantic elements support internal and external CSS styling. You can apply styles like padding, color, borders, margin, etc., just like you do with '<div>'.
Semantic HTML makes your website structure more meaningful and SEO-friendly. Tags like '<header>', '<main>', '<section>', and '<article>' help browsers and search engines understand your content better. Always prefer semantic elements over non-semantic ones to create accessible, maintainable, and optimized web pages.
Semantic elements give meaning to your content and improve SEO and accessibility.
Yes, semantic elements fully support CSS styling.
Yes, all modern browsers support HTML5 semantic elements.
Unlike '<div>' and '<span>', semantic elements have meaningful names and structure.