Content · Web Development · HTML

HTML Syntax Reference: Tokens, Elements, and Attributes

Learn syntax reference: tokens, elements, and attributes with a clear explanation, practical HTML markup, a walkthrough and common mistakes to avoid.

1 views Published Oct 19, 2026 Updated Oct 19, 2026 Admin

A small piece of HTML can change what a visitor sees or how the browser understands a page. In this lesson, you will explore syntax reference: tokens, elements, and attributes using a short example that you can inspect and change.

The Idea in Plain English


The HTML specification defines what kind of content belongs inside each element. A list uses li children, a table has structural row and cell rules, and a paragraph accepts phrasing content rather than div elements.

You can test this using a small local HTML file. Change one part at a time and check the result in the browser before adding more code.

A Working Example


Read the sample once before copying it. Notice the element names and attribute values, then compare them with the explanation below.

<section>
    <h2>Shopping List</h2>
    <ul>
        <li>Bread</li>
        <li>Milk</li>
    </ul>
</section>

What Each Part Does


  • A section groups material about a related topic and usually has a heading.
  • The h2 identifies a major subsection.
  • A ul is an unordered list of related items.

A browser may fix invalid nesting automatically, so a page that looks fine can still have an unexpected DOM tree.

Try It Yourself


Try this next: analyze a nested form snippet. Then inspect the page and explain what changed.

Common Beginner Mistakes


  • Checking only whether a page looks correct while ignoring the semantic nesting rules.
  • Changing several parts of the example at once, making it difficult to see which part caused a different result.
  • Choosing a tag only because its default appearance looks right, without checking whether it describes the content correctly.

Key Takeaways


  • The HTML specification defines what kind of content belongs inside each element. A list uses li children, a table has structural row and cell rules, and a paragraph accepts phrasing content rather than div elements.
  • A browser may fix invalid nesting automatically, so a page that looks fine can still have an unexpected DOM tree.
  • Test the markup in a browser, and check accessibility and real-world behavior where relevant.
Share this resourceSend this page to someone who may find it useful.