Semantic Elements
Semantic elements are HTML tags that convey meaning beyond their visual appearance. They provide context to the content within the tags and help search engines, screen readers, and other devices understand the purpose of the content. Some examples of semantic elements include <header>, <footer>, <nav>, <article>, <aside>, and <main>.
Here's an example of how to use a semantic element, such as the <header> tag:
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
</head>
<body>
<header>
<h1>Welcome to my website!</h1>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header>
<main>
<p>This is the main content of my website.</p>
</main>
<footer>
<p>© 2023 My Website. All rights reserved.</p>
</footer>
</body>
</html>
No comments:
Post a Comment