HTML
Anatomy

index.html

Master the building blocks of the web

01

Elements and Tags

HTML elements are the basic building blocks of web pages. Most elements consist of an opening tag, content, and a closing tag. Think of them as containers that tell the browser how to display content.

elements.html
<!-- Headings -->
<h1>Main Heading</h1>
<h2>Subheading</h2>

<!-- Paragraph -->
<p>This is a paragraph.</p>

<!-- Self-closing tag -->
<img src="image.jpg" alt="Description">

Try It:

02

Attributes

Attributes provide additional information about elements and are always specified in the opening tag. They consist of a name and a value, like adjusting settings for each element.

attributes.html
<!-- Common attributes -->
<div id="main-content" class="container">
  Content
</div>

<img
  src="photo.jpg"
  alt="A beautiful sunset"
  width="600"
>

<a href="https://example.com">Link</a>

Try It:

03

Lists

HTML offers several ways to create lists: unordered (bulleted), ordered (numbered), and definition lists. Lists help organize related items in a structured way.

lists.html
<!-- Unordered list -->
<ul>
  <li>HTML</li>
  <li>CSS</li>
  <li>JavaScript</li>
</ul>

<!-- Ordered list -->
<ol>
  <li>Learn HTML</li>
  <li>Learn CSS</li>
  <li>Learn JavaScript</li>
</ol>

Try It:

      04

      Semantic HTML

      Semantic HTML uses elements that clearly describe their meaning to both the browser and developers. This improves accessibility, SEO, and code maintainability.

      semantic.html
      <header>
        <h1>My Website</h1>
        <nav>
          <a href="#">Home</a>
          <a href="#">About</a>
        </nav>
      </header>
      
      <main>
        <article>
          <h2>Article Title</h2>
          <p>Content...</p>
        </article>
      </main>
      
      <footer>
        <p>© 2025</p>
      </footer>

      Document Structure:

      <header> Site header & navigation
      <main> Primary content
      <aside> Sidebar content
      05

      Forms

      Forms allow users to input data and interact with your website. They include various input types, labels, buttons, and other controls for collecting information.

      forms.html
      <form>
        <label for="name">Name:</label>
        <input
          type="text"
          id="name"
          required
        >
      
        <label for="email">Email:</label>
        <input
          type="email"
          id="email"
        >
      
        <button type="submit">Submit</button>
      </form>

      Try It:

      06

      Tables

      Tables display structured, tabular data in rows and columns. They consist of headers, body rows, and optional footers to organize information clearly.

      tables.html
      <table>
        <thead>
          <tr>
            <th>Name</th>
            <th>Role</th>
            <th>Year</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>HTML</td>
            <td>Structure</td>
            <td>1993</td>
          </tr>
        </tbody>
      </table>

      Example:

      Technology Purpose Year
      HTML Structure 1993
      CSS Styling 1996
      JavaScript Behavior 1995

      HTML Playground

      Write your own HTML code and see it come to life instantly

      HTML Editor
      localhost:3000/preview