codingstuff.io
ExploreTutorialsProblemsCS Subjects
Get Started
ExploreTutorialsProblemsCS Subjects
Get Started
codingstuff.io

Master the art of building software through interactive tutorials, real-world problems, and guided projects.

Pune, Maharashtra, India

codingstuffmail@gmail.com

Product

  • Explore
  • Tutorials
  • Problems
  • CS Subjects

Company

  • About
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Sitemap

© 2026 codingstuff.io. All rights reserved.

Built with ❤️ for developers everywhere

/
/
All Tutorials
🎨

HTML & CSS

1 / 59 topics
1Introduction to HTML2HTML Elements3HTML Attributes4HTML Document Structure5HTML Text Formatting6HTML Links7HTML Images8HTML Lists9HTML Tables10HTML Forms
Tutorials/HTML & CSS/Introduction to HTML
🎨HTML & CSS

Introduction to HTML

Updated 2026-04-20
3 min read

Introduction to HTML

HTML (HyperText Markup Language) is the standard markup language for creating web pages and web applications. It provides a way to structure content on the web, making it both human-readable and machine-readable. In this tutorial, we'll cover the basics of HTML, including its syntax, elements, attributes, and best practices.

What is HTML?

HTML is not a programming language but rather a markup language used to describe the structure of web pages. It uses tags to define elements within a page, such as headings, paragraphs, links, images, and more. These tags are enclosed in angle brackets (< >), and they tell the browser how to display the content.

Basic HTML Structure

A basic HTML document consists of several key components:

  1. DOCTYPE Declaration: This tells the browser what version of HTML the page is using.
  2. HTML Element: The root element that contains all other elements.
  3. Head Element: Contains meta-information about the document, such as its title and links to stylesheets.
  4. Body Element: Contains the content of the document that is displayed on the web page.

Here's a simple example of an HTML document:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My First Web Page</title>
</head>
<body>
    <h1>Welcome to My Website</h1>
    <p>This is a paragraph of text.</p>
</body>
</html>

Explanation

  • <!DOCTYPE html>: Declares the document type and version of HTML.
  • <html lang="en">: The root element, with a language attribute set to English.
  • <head>: Contains meta-information about the document.
    • <meta charset="UTF-8">: Specifies the character encoding for the document.
    • <meta name="viewport" content="width=device-width, initial-scale=1.0">: Ensures the page is responsive and scales correctly on different devices.
    • <title>: Sets the title of the web page, which appears in the browser tab.
  • <body>: Contains the visible content of the web page.

HTML Elements

HTML elements are the building blocks of an HTML document. They are defined by a start tag, content, and an end tag. For example:

<h1>This is a Heading</h1>
<p>This is a paragraph.</p>

Common HTML Elements

  • Headings: <h1> to <h6>, with <h1> being the largest.
  • Paragraphs: <p>
  • Links: <a href="URL">Link Text</a>
  • Images: <img src="image.jpg" alt="Description of image">
  • Lists:
    • Unordered: <ul><li>Item 1</li><li>Item 2</li></ul>
    • Ordered: <ol><li>Item 1</li><li>Item 2</li></ol>
  • Divisions: <div> and <span> for grouping elements.

Attributes

Attributes provide additional information about HTML elements. They are added to the start tag of an element and consist of a name and value pair, separated by an equals sign (=). For example:

<a href="https://www.example.com" target="_blank">Visit Example</a>
<img src="logo.png" alt="Company Logo">

Common Attributes

  • href: Specifies the URL for links.
  • src: Specifies the source file for images and other media.
  • alt: Provides alternative text for images, useful for accessibility.
  • class and id: Used for styling and scripting purposes.

Best Practices

  1. Semantic HTML: Use appropriate tags to describe the content accurately (e.g., use <header>, <footer>, <nav>).
  2. Accessibility: Include alt attributes for images, use headings properly, and ensure keyboard navigability.
  3. Validation: Validate your HTML using tools like the W3C Markup Validation Service to catch errors.
  4. Responsive Design: Use meta tags and flexible layouts to ensure your web pages look good on all devices.

Conclusion

HTML is a fundamental technology for web development, providing the structure and content of web pages. By understanding its basic syntax, elements, attributes, and best practices, you can create well-structured and accessible web pages. In the next section, we'll dive deeper into CSS to learn how to style these HTML elements.

Further Reading

  • MDN Web Docs - HTML
  • W3Schools - HTML Tutorial
  • The Odin Project - HTML Course

By following this tutorial and exploring these resources, you'll gain a solid foundation in HTML and be ready to move on to more advanced topics in web development.


Next HTML Elements

Recommended Gear

HTML Elements