HTML Semantic Structure
HTML is not about using div in every tag. Get used to using HTML semantic elements from the beginning. HTML5 semantic elements help structure the code we create, making it more readable and easier to maintain. They help us think about the structure of our dynamic data, and to choose titles’ hierarchy properly.
What is HTML Semantic Structure?
A semantic element clearly describes its meaning to both the browser and the developer. Many websites contain HTML code to indicate navigation, header, and footer. So basically each section of the page has its own HTML tag. The elements clearly describe its meaning & help increase accessibility.
<div class=”footer”></div> ❌
<footer></footer>✅
Semantic Tags
Why Semantic Tags?
- They are machine and human-readable.
- Increase SEO score, as Search crawler knows part of the page they are crawling
- Good for accessibility.
Let’s look at some Semantic HTML structure elements 👇
<header>
The <header> element represents a container for introductory content or a set of navigational links.
<aside>
The <aside> element defines some content aside from the content it is placed in (like a sidebar). The <aside> content should be indirectly related to the surrounding content.
<main>
The <main> tag specifies main content of the HTML document. The content inside the <main> element should be unique to the document. It should not contain any content that is repeated across documents such as sidebars, navigation links, copyright information, site logos, and search forms.
<nav>
The <nav> element defines a set of navigation links.
<section>
The <section> element defines a section in a document. A section is a thematic grouping of content, typically with a heading. A web page could normally be split into sections for introduction, content, and contact information.
0 Response to "HTML Semantic Structure"
Post a Comment