A Semantic HTML element generally describes its meaning to both the browser and the developer. HTML contains both semantic and non-semantic elements.
Non-semantic elements are the one that doesn’t specify any meaning about its content
Semantic elements on the other hand specify the meaning of their content.
<article> <aside> <details> <figure> <figcaption> <footer> <header>
<main> <nav> <section> <summary> <time> <h1>...<h6>
Some of the benefits from writing semantic markup are as follows:
- Search engines will consider its contents as important keywords to influence the page’s search rankings
- Screen readers can use it as a signpost to help visually impaired users navigate a page
- Finding blocks of meaningful code is significantly easier than searching through endless
divs with or without semantic or namespaced classes
- Suggests to the developer the type of data that will be populated
- Semantic naming mirrors proper custom element/component naming.
An article element represents a self-contained composition in a document, page, application, or site, which is intended to be independently distributable or reusable. A given document can have multiple articles in it. For example, on a blog that shows the text of each article one after another as the reader scrolls, each post would be contained in an
<article> element, possibly with one or more
<h1>Weather forecast for Seattle</h1>
<h2>03 March 2018</h2>
<h2>04 March 2018</h2>
<p>Periods of rain.</p>
<h2>05 March 2018</h2>
Note: both starting and ending tags are mandatory only includes the global attributes.
An aside 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. Mostly aside tags are used to display the advertisements on the side of the content where the advertisement is actually not the part of the content directly.
<p>Salamanders are a group of amphibians with a lizard-like appearance, including short legs and a tail in both larval and adult forms.</p><aside>
<p>The Rough-skinned Newt defends itself with a deadly neurotoxin.</p>
</aside><p>Several species of salamander inhabit the temperate rainforest of the Pacific Northwest, including the Ensatina, the Northwestern Salamander and the Rough-skinned Newt. Most salamanders are nocturnal, and hunt for insects, worms and other small creatures.</p>
The above code will ideally look like the following screenshot of the page.
A details element creates a disclosure widget in which information is visible only when the widget is toggled into an “open” state. A summary or label must be provided using the
A disclosure widget is typically presented onscreen using a small triangle that rotates (or twists) to indicate open/closed status, with a label next to the triangle. The contents of the
<summary> element is used as the label for the disclosure widget.
<summary>I am the title</summary>
I am the hidden description
An open attribute can be added to the Details tag to set the tab open by default.
Figure & Figcaption
A figure element represents self-contained content, potentially with an optional caption, which is specified using the
<figcaption> element. The figure, its caption, and its contents are referenced as a single unit.
Figcaption or Figure Caption element represents a caption or legend describing the rest of the contents of its parent
alt="Elephant at sunset">
<figcaption>An elephant at sunset</figcaption>
A Footer element represents a footer for its nearest sectioning content or sectioning root element. A
<footer> typically contains information about the author of the section, copyright data, or links to related documents.
<p>© 2021 by Senthur Athiban</p>
A Header element represents introductory content, typically a group of introductory or navigational aids. It may contain some heading elements but also a logo, a search form, an author name, and other elements.
<p>I am the <em>main</em> content with some random text here.</p>
A Main represents the main content of the
<body> in document. The main content area consists of content that is directly related to or expands upon the central topic of a document, or the central functionality of an application.
<p>Body Content 1</p>
<p>Body Content 2</p>
A Nav element represents the navigation links that take to the content with the page or to another document.
<li class="crumb"><a href="#">Menu1</a></li>
<li class="crumb"><a href="#">Menu2</a></li>
<p>Content of the page</p>
A section element represents a section of a document that doesn’t have a more specific semantic element to represent it. Sections should always have a heading, with very few exceptions.
<p>This is the content of section 1</p>
<p>This is the content of section 2</p>
This element specifies a short description, caption, or legend for a
<details> element's disclosure box. Clicking the
<summary> element toggles the state of the parent
<details> element open and closed.
<summary>what is a summary ?</summary>
Clicking the summary element toggles the state of the parent element open and closed.
The Time element represents a specific period in time that includes the
datetime attribute to translate dates into a machine-readable format, allowing for better search engine results. It can be represented in one of the following formats
- 24-hour clock
- Gregorian calendar (with optional time and timezone information)
- Valid time duration
This content contains datetime
<time datetime="2018-07-07">July 7</time>
content contains duration
<time datetime="PT2H30M">2h 30m</time>
H1 … H6
The Heading element represents six levels of section headings.
<h1> is the highest section level and
<h6> is the lowest.
Additional Points to remember
- Make sure to use appropriate content-specific elements.
- Each element has its own advantages and does not randomly pick elements for displaying content as they directly reflect in your SEO benefits.
- Only one H1 element to be present for the entire page. Any number of h2 to h6 can be used on the same page.
- Nav links or footer links if linked to a different page other than your own site and if you do not want your traffic to be shifted to that external page then make sure nofollow and noreferrer added in rel attribute with the anchor tag.
rel=”noreferrer nofollow”>Click here to visit Point Jupiter website.