Introduction to HTML

Learn Introduction to HTML with practical examples, explanations, best practices, and real-world coding techniques.

Try Editor

What is HTML?

Every website you open in a browser — YouTube, Amazon, Instagram, blogs, portfolios, or web applications — is built using HTML at its core.

HTML stands for HyperText Markup Language. It is the standard language used to create and structure web pages on the internet.

HTML tells the browser what content should appear on the screen and how that content should be organized.

Without HTML, browsers would not know where to display headings, paragraphs, images, videos, buttons, forms, navigation menus, or links.

HTML is responsible for structure and content only. Styling and interactivity are handled by CSS and JavaScript.

Why Learning HTML Matters

HTML is the foundation of frontend and full-stack web development. Before learning advanced technologies like React, Angular, Vue, or backend frameworks, developers first learn how webpages are structured using HTML.

Even modern frameworks ultimately generate HTML because browsers understand HTML as the primary structure of the web.

A strong understanding of HTML helps developers build better websites, improve accessibility, write cleaner code, and understand how browsers work internally.

  • Creates the structure of webpages
  • Organizes content into meaningful sections
  • Helps search engines understand content
  • Improves accessibility for users and screen readers
  • Works together with CSS and JavaScript
  • Acts as the backbone of every modern website

Understanding HTML, CSS, and JavaScript

Modern websites are usually built using three core technologies: HTML, CSS, and JavaScript.

  • HTML acts like the skeleton of the website. It creates the structure and content.
  • CSS works like the visual design and appearance. It controls colors, layouts, spacing, fonts, and responsiveness.
  • JavaScript adds behavior and interactivity, such as dropdown menus, sliders, form validation, animations, and dynamic updates.

You can think of a website like a human body:

  • HTML = Skeleton and structure
  • CSS = Appearance and styling
  • JavaScript = Logic and interaction

How Websites Work in a Browser

When you open a website, your browser sends a request to a web server.

The server responds by sending files back to the browser. One of the first files returned is usually an HTML document.

The browser reads the HTML from top to bottom and builds the visible structure of the webpage.

After that, CSS styles the page visually, and JavaScript adds interactivity and dynamic behavior.

This means HTML acts as the starting point for everything displayed on a webpage.

Understanding HTML Tags

HTML uses special keywords called tags to define elements on a webpage.

Tags tell the browser what type of content should appear on the screen.

Most HTML elements contain:

  • An opening tag
  • The content inside the element
  • A closing tag

For example, a paragraph uses the <p> tag.

The browser understands that everything inside the paragraph tag should be displayed as paragraph text.

What HTML is Made Of

  • Tags — Keywords inside angle brackets such as <h1> or <p>
  • Elements — A complete structure made of opening tag, content, and closing tag
  • Attributes — Additional information added to elements
  • Nesting — Placing elements inside other elements to build layouts and structure

Common HTML Tags Beginners Use

Tag Purpose
<h1> to <h6> Headings
<p> Paragraphs
<a> Links
<img> Images
<div> Containers and layout sections
<span> Inline content grouping

Real-World Example

Imagine an online shopping website. HTML is used to structure:

  • The navigation menu
  • Product titles and descriptions
  • Images of products
  • Prices and ratings
  • Add to Cart buttons
  • Checkout forms
  • Footer links and contact information

Without HTML, browsers would not know how to organize or display any of this content.

Basic Structure of an HTML Document

Every HTML document follows a basic structure.

The browser expects certain sections such as the document type, head section, and body section.

The <head> section contains metadata like the page title and settings.

The <body> section contains everything visible on the webpage.

What HTML Can and Cannot Do

HTML Can Do HTML Cannot Do
Structure webpages Create advanced animations alone
Display text, images, videos, and forms Handle complex application logic
Improve accessibility and SEO Replace JavaScript functionality

Writing Your First HTML File

HTML files use the .html extension.

You can create HTML files using any code editor such as Visual Studio Code.

After saving the file, simply open it in a browser to see the webpage rendered visually.

Browsers automatically interpret HTML code and convert it into visible webpages.

Common Beginner Mistakes

  • Forgetting to close tags properly
  • Incorrect nesting of elements
  • Confusing HTML with CSS or JavaScript
  • Writing content outside the body element
  • Using HTML for styling instead of structure
  • Not properly indenting code for readability

Best Practices for Beginners

  • Write clean and properly indented HTML
  • Use semantic HTML whenever possible
  • Keep code readable and organized
  • Always use proper document structure
  • Use lowercase tag names consistently
  • Test webpages in the browser regularly

Summary

HTML is the standard language used to structure websites and web applications.

It defines the content browsers display and acts as the foundation of modern web development.

Learning HTML is the first major step toward becoming a frontend or full-stack developer.

Once you understand HTML properly, learning CSS, JavaScript, frameworks, accessibility, and modern frontend development becomes much easier.

Code Examples

html

<!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 HTML</h1>

  <p>
    HTML is used to structure web pages.
  </p>
</body>
</html>
    
html

<header>
  <h1>IgKnight Learning Platform</h1>

  <nav>
    <a href="/">Home</a>
    <a href="/courses">Courses</a>
    <a href="/contact">Contact</a>
  </nav>
</header>

<main>
  <section>
    <h2>Learn Modern Web Development</h2>

    <p>
      Explore beginner-friendly tutorials
      for HTML, CSS, and JavaScript.
    </p>

    <a href="/html-introduction">
      Start Learning HTML
    </a>
  </section>
</main>
    
html

<h1>Online Store</h1>

<p>
  Browse our latest collection of products.
</p>

<img
  src="products.jpg"
  alt="Product collection"
/>

<button>
  View Products
</button>
    

Pro Tip

Focus on understanding structure and semantic meaning before learning advanced frameworks. Strong HTML fundamentals improve accessibility, SEO, maintainability, and long-term frontend development skills.

More HTML lessons

🎨 IgKnight Docs

Master HTML, CSS, JS, Python, .NET and more with easy-to-follow lessons and practical code examples.

© 2025 IgKnight Learning Platform. All rights reserved.