What are Semantic Elements?

What are Semantic Elements?

 Most common question ask in interview.

What are Semantic Elements?

A semantic element clearly describes its meaning to both the browser and the developer.

Examples of non-semantic elements: <div> and <span> - Tells nothing about its content.

Examples of semantic elements: <form><table>, and <article> - Clearly defines its content.

Semantic Elements in HTML

Many web sites contain HTML code like: <div id=”nav”> <div class=”header”> <div id=”footer”> to indicate navigation, header, and footer.

In HTML there are some semantic elements that can be used to define different parts of a web page:

  1. <article>
  2. <aside>
  3. <details>
  4. <figcaption>
  5. <figure>
  6. <footer>
  7. <header>
  8. <main>
  9. <mark>
  10. <nav>
  11. <section>
  12. <summary>
  13. <time>

Post a Comment

Previous Post Next Post