...
Sign in

What is HTML? Tags, Attributes, & Document Anatomy

Start your web development journey from scratch: understand how the web works, HTML tag anatomy, attributes, and the fundamental HTML5 document skeleton.

Share:

What is HTML? Tags, Attributes, & Document Anatomy

Every webpage you visit on the internet—from Google and Wikipedia to YouTube and Thinkora—is built on a foundation called HTML (HyperText Markup Language).

If a website were a building:

  • HTML is the foundation, concrete pillars, and brick walls (the structure).
  • CSS is the paint, windows, furniture, and lighting (the visual design).
  • JavaScript is the electrical wiring, plumbing, and elevators (the interactivity).

1. How the Web Works

When you type a URL like https://thinkora.com into your browser:

  1. Your browser sends a request across the internet to a web server.
  2. The server responds with plain text files: HTML, CSS, and JavaScript.
  3. Your browser reads (parses) the HTML tags and renders them into visual text, images, and buttons on your screen.

2. The Anatomy of an HTML Element

HTML is composed of elements. Most elements have three parts:

  1. Opening Tag: Declares the start of the element (e.g. <p>).
  2. Content: The actual text, image, or nested element inside.
  3. Closing Tag: Declares the end of the element with a forward slash (e.g. </p>).
  ┌─────────────── Opening Tag (with attribute)
  │      ┌──────── Content
  │      │        ┌────── Closing Tag
┌─┴──┐┌──┴───┐ ┌──┴─┐
<p class="intro">Namaste World!</p>
   │       │
   │       └────── Attribute Value
   └────────────── Attribute Name

Attributes: Giving Elements Superpowers

Attributes supply extra information and configuration to tags. They always appear inside the opening tag and follow the format:

name="value"\text{name}=\text{"value"}

  • class="primary": Adds an identifier for styling with CSS.
  • id="main-nav": Gives the element a unique identifier on the entire page.
  • href="https://...": Tells a link where to navigate.

3. Interactive Tag & Document Anatomy Studio

Click on each piece of an HTML tag to inspect its technical role, and explore the complete standard HTML5 document skeleton.

HTML Anatomy & Document Anatomy Studio

Beginner Foundation

Inspect how tags, attributes, and full HTML document skeletons work under the hood.

Anatomy of an HTML Element

An HTML element consists of an Opening Tag (with optional attributes), the Content, and a Closing Tag. Click each piece below to inspect its purpose.

<=>
Inspected Component:
Tag Name: <a> (Anchor Tag)

Tells the browser what kind of element this is. An anchor tag (<a>) creates a hyperlink that users can click to navigate to other pages.


4. The HTML5 Document Skeleton Explained

Every standard HTML file (index.html) requires five essential architectural tags:

<!DOCTYPE html><html lang="en">  <head>    <meta charset="UTF-8">    <meta name="viewport" content="width=device-width, initial-scale=1.0">    <title>My First Webpage</title>  </head>  <body>    <h1>Welcome to My Website</h1>    <p>This is where visible content lives!</p>  </body></html>

1. <!DOCTYPE html>

Tells the browser to render the page using the modern HTML5 standard rather than legacy 1990s quirks mode.

2. <html lang="en">

The root container that wraps all content on the page. The lang attribute tells search engines and screen readers what human language the page is written in.

3. <head>

Holds metadata for machines and browsers. Nothing inside <head> is rendered on the visible canvas (except the <title> which appears in the browser tab).

4. <body>

The visible canvas! Everything users see, read, and click—headings, paragraphs, images, videos, and buttons—lives inside <body>.


5. Void (Self-Closing) Elements

While most elements require a closing tag, some elements cannot hold content. These are called Void Elements and do not have closing tags:

  • <img>: Embeds an image (<img src="photo.jpg" alt="A photo">)
  • <input>: Creates a form text field (<input type="text">)
  • <br>: Inserts a simple line break
  • <hr>: Draws a horizontal dividing line

6. Live Interactive HTML & CSS Playground

Experiment with real code in real-time below! Modify tags, edit text, or switch to the CSS tab to style elements on the fly:

Your First HTML & CSS Sandbox

Live Sandbox

Try typing new <h1>, <p>, or <button> tags into index.html and watch your browser preview update immediately.

index.htmlLive Auto-Compile
Live Output Browser View100% Fluid

7. Flashcards & Core Concepts

Active Recall
Card

What is the difference between <head> and <body> in HTML?

Click or Press Space to Flip
Key Takeaway
contains machine metadata (title, character encoding, CSS links) not visible on the webpage. contains all visible content that users interact with on screen.
Click to Flip Back
Active Recall
Card

What are void (self-closing) elements in HTML?

Click or Press Space to Flip
Key Takeaway
Void elements (like ,
, ) cannot have content inside them and therefore do not have a closing tag.
Click to Flip Back

8. Knowledge Check

CheckpointCheckpoint
Question 1 of 3Score: 0/3

What is the purpose of the <!DOCTYPE html> declaration at the top of an HTML file?

Lesson Milestone

Finished Reading This Lesson?

Mark this lesson complete. A chapter counts as done once all its lessons are, and that adds to your course progress.

TH

Written by

ThinkWisely Team

Have a Question or Suggestion?

We'd love to hear from you. Drop your thoughts below to help us improve ThinkWisely!