Vadim Makeev, HTML Academy
Semantics
is like monads.
<b>
or <strong>
<section>
or <article>
<div>
or <span>
<i>
for icons?Well, it does if you care. But you don’t have to.
User Experience
<div>
— 497 whatever<img alt>
— 0 of 53 oh, damn<a href></a>
— 7 not good<h*>
— 0 pure evil<html lang="en">
, <html lang="ru">
<h1>
, <h2>
, <h3>
, <h4>
, <h5>
, <h6>
<img alt="">
, <svg role="image" aria-label="">
<figure>
, <figcaption>
<ul>
, <ol>
, <li>
For search engines, reader modes, screen readers, new devices.
<header>
, <main>
, <aside>
, <footer>
<h1>
, <h2>
, <h3>
, <h4>
, <h5>
, <h6>
<fieldset>
, <legend>
, <input>
<button>
and <a>
<a href="" aria-label="Twitter"></a>
For keyboard and screen reader users.
<body>
<h1>Heading 1</h1>
<p>The quick green frog</p>
<h2>Heading 2</h2>
<p>Jumps over the lazy dog</p>
</body>
<body>
<header>Header</header>
<nav>Navigation</nav>
<main>Main content</main>
<aside>Secondary content</aside>
<footer>About</footer>
</body>
<header>
<h1>Telegram</h1>
<a href="/contacts">Contacts</a>
<a href="/chats">Chats</a>
<a href="/options">Options</a>
</header>
<nav>
<h2>Chats</h2>
<a href="/chat-1">
<img src="chat-1" alt="Chat 1">
<h3>Chat 1</h3>
</a>
</nav>
<main id="chat-1">
<h2>Chat 1</h2>
<p>Whassup?</p>
<p>Whassup!</p>
</main>
<main id="chat-2" hidden>
<main id="chat-3" hidden>
Semantics is easy.
If you know why.
Now you know.