What are Semantic Elements?
HTML5 Semantic elements are those which clearly describe its meaning to both the browser and the developer. HTML5 semantic elements have meaningful names that tell about the type of content. For example header, footer, table, etc. Many semantic elements are introduced in HTML5 that make the code easier to write and understand for the developer.
The semantic elements added in HTML5 are:
- <article>
- <aside>
- <details>
- <figcaption>
- <figure>
- <footer>
- <header>
- <main>
- <mark>
- <nav>
- <section>
- <summary>
- <time>
HTML5 <article> Element:
The <article> element is used to define a self-contained, independent content that is intended to be independently distributable or reusable. The content of the <article> element has its own meaning and it can be easily differentiated from the rest of the webpage content.
Possible source for Article Element are :
- A magazine/newspaper article
- A blog entry
- A forum post
- A user submitted comment
Example:
<article>
<h2> Hypertext markup language(HTML) </h2>
<p> HTML is a markup language using which you can create your website. HTML stands for Hypertext Markup Language. It contains elements and the elements are represented by tags. You can create a static webpage by using HTML only. Technically HTML is not a programming language it is a markup language. </p>
</article>
HTML5 <aside> Element:
The <aside> element is used to define content which is indirectly giving information to the main content of the webpage. It is used to improve an article with additional information and it is frequently represented as a sidebar.
Example:
<p> I have learned HTML. </p>
<aside>
<h3> HTML </h3>
<p> HTML is a markup language using which you can create your website. HTML stands for Hypertext Markup Language. It contains elements and the elements are represented by tags. You can create a static webpage by using HTML only. Technically HTML is not a programming language it is a markup language. </p>
</aside>
HTML5 <details> Element:
The HTML <details> tag is used to specify additional details that the user can view or hide on demand.
It can be used in conjunction with the <summary> tag of HTML5 to provide a heading that can be clicked on to expand/collapse the details as required.
Example:
<details>
<summary> What is HTML?</summary>
<p> HTML is a markup language using which you can create your website.
HTML stands for Hypertext Markup Language.
It contains elements and the elements are represented by tags.
You can create a static webpage by using HTML only.
Technically HTML is not a programming language it is a markup language. </p>
</details>
HTML5 <figcaption> Element:
The <figcaption> tag is used to specify a caption for a <figure> element. The <figcaption> is used as a child of <figure> element to give a caption to the table, image or chart. It is used either as the first or last child of its parent <figure> tag.
Example:
<figure>
<img src="sample.jpg" alt="html5 semantic elements - sample image">
<figcaption> HTML5 semantic elements - Figure.1 Sample Image </figcaption>
</figure>
HTML5 <figure> Element:
The <figure> tag is used to specify self-contained content like diagrams, photos, code listings, etc. The <figure> element can be used to associate a caption together with some embedded content such as graphics or video. The <figure> element can be used in conjunction with the <figcaption> element to give the caption to the contents of the <figure> element.
Example:
<figure>
<img src="sample.jpg" alt="html5 semantic elements - sample image">
</figure>
HTML5 <footer> Element:
The <footer> element is used to define a footer of HTML document or section. The <footer> element contains information about the author of the document, copyright information, links to related documents, etc.
Example:
<footer>
<nav>
<p><a href="#"> Terms of Use </a> | <a href="#"> Privacy Policy </a></p>
</nav>
<p> Copyright © 2019 W3CodingSchools </p>
</footer>
HTML5 <header> Element:
The <header> element is used to represent the header of a document or section. It contains information related to the title and heading of the related content.
Example:
<header>
<h2> W3CodingSchools </h2>
<nav>
<p><a href="#"> Home </a> | <a href="#"> About </a> | <a href="#"> Contact </a></p>
</nav>
</header>
HTML5 <main> Element:
The <main> tag is used to represent the main content of the HTML document.
It surrounds the main content of the page, content that is unique to that document and it should not contain the duplicated content across multiple webpages such as header, footer, and navigation elements.
Example:
<main>
<h2> Web Technologies </h2>
<article>
<h2> HTML </h2>
<p> HTML is a markup language using which you can create your website.
HTML stands for Hypertext Markup Language.
It contains elements and the elements are represented by tags.
You can create a static webpage by using HTML only.
Technically HTML is not a programming language it is a markup language. </p>
</article>
<article>
<h2> CSS </h2>
<p> CSS is the acronym for Cascading Style Sheets.
It is widely used language on the web.
Styles are set using CSS properties. For example, you can set font properties (size, colors, style etc), background color, border styles, and much more. </p>
</article>
<article>
<h2> Bootstrap </h2>
<p> Bootstrap is the most popular HTML, CSS, and JavaScript framework for developing responsive and mobile-friendly websites or web applications.
It also gives you the ability to create Responsive Web Designs.
It is an open-source framework and free to download and use. </p>
</article>
</main>
HTML5 <mark> Element:
The <mark> element is used to represent text which is marked or highlighted for reference or notation purposes.
The text on which mark element has been added is considered to be particularly relevant in a specific context.
HTML5 <nav> Element:
The <nav> element is used to define a block of navigation link, either within the current document or to other documents.
Example:
<nav>
<a href="/learn-html.html"> HTML </a> |
<a href="/learn-css.html"> CSS </a> |
<a href="/learn-bootstrap.html"> Bootstrap </a> |
<a href="/learn-javascript.html"> JavaScript </a>
</nav>
HTML5 <section> Element:
The <section> element is used to define the section in a document, such as chapters, headers, footers or any other sections of the document.
Example:
<section>
<h2> HTML </h2>
<p> HTML is a markup language using which you can create your website.
HTML stands for Hypertext Markup Language.
It contains elements and the elements are represented by tags.
You can create a static webpage by using HTML only. </p>
</section>
HTML5 <summary> Element:
The <summary> tag is used to define a summary for the <details> element.
It is used along with the <details> element to provide a summary visible to the user.
The content placed inside the <details> element will become visible when the user clicks the summary.
Example:
<details>
<summary> What is HTML? </summary>
<p> HTML is a markup language using which you can create your website.
HTML stands for Hypertext Markup Language.
It contains elements and the elements are represented by tags.
You can create a static webpage by using HTML only. </p>
</details>
HTML5 <time> Element:
The <time> element is used to represent a specific period in time which is in a human-readable format.
The <time> element may include the datetime attribute to translate dates into a machine-readable format to allow better search engine results.
Example:
<p> The conference will start on <time datetime="2019-09-08 08:00"> Tuesday at 8:00 AM </time> in conference hall. </p>