Back to Home
    HTMLHTML HTML5Beginner

    HTML

    Semantic elements, forms, accessibility attributes, meta tags, and modern HTML5 features.

    8 min read
    htmlmarkupfrontendaccessibility

    Document Structure

    1 topic

    HTML Boilerplate

    Standard HTML5 document structure

    html
    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Page Title</title>
      <meta name="description" content="Page description">
      <link rel="stylesheet" href="styles.css">
    </head>
    <body>
      <header>...</header>
      <main>...</main>
      <footer>...</footer>
      <script src="app.js"></script>
    </body>
    </html>

    💡 Always include lang attribute on html

    📌 Place scripts at end of body or use defer

    Semantic Elements

    1 topic

    Layout Elements

    Use semantic HTML for meaningful structure

    html
    <header>Site header, navigation</header>
    <nav>Navigation links</nav>
    <main>Primary page content (one per page)</main>
    <article>Self-contained content</article>
    <section>Thematic grouping</section>
    <aside>Sidebar, related content</aside>
    <footer>Footer content</footer>
    <figure>
      <img src="photo.jpg" alt="Description">
      <figcaption>Caption text</figcaption>
    </figure>

    💡 Semantic HTML improves SEO and accessibility

    📌 Only one <main> element per page

    Forms

    1 topic

    Form Elements

    Collect user input with form controls

    html
    <form action="/submit" method="POST">
      <label for="email">Email</label>
      <input type="email" id="email" name="email" required>
    
      <label for="password">Password</label>
      <input type="password" id="password" minlength="8">
    
      <select name="role">
        <option value="user">User</option>
        <option value="admin">Admin</option>
      </select>
    
      <textarea name="bio" rows="4"></textarea>
    
      <button type="submit">Submit</button>
    </form>

    💡 Always associate labels with inputs via for/id

    ⚡ Use built-in validation attributes (required, pattern, min, max)

    Related Articles

    Background reading and deeper explanations for this sheet.