What is HTML?

 

1. What is HTML?

HTML (HyperText Markup Language) is the standard language used to create web pages.

  • It defines the structure of a webpage

  • It tells the browser what content is (heading, paragraph, image, link, etc.)

  • HTML is not a programming language — it’s a markup language

👉 Think of HTML as the skeleton of a website.


2. Basic Structure of an HTML Document

Every HTML page follows a basic structure:

<!DOCTYPE html> <html> <head> <title>My First Web Page</title> </head> <body> <h1>Hello World</h1> <p>This is my first HTML page.</p> </body> </html>

3. Explanation of Each Part

<!DOCTYPE html>

  • Tells the browser that this document is HTML5

  • Must be the first line of the document


<html> Tag

  • Root element of the HTML page

  • All HTML content is written inside this tag


<head> Tag

Contains meta-information about the page (not visible):

  • Page title

  • Character encoding

  • CSS links

  • SEO information

Example:

<head> <title>Website Title</title> </head>

<title> Tag

  • Sets the title shown in the browser tab

  • Important for SEO


<body> Tag

  • Contains all visible content of the webpage:

    • Text

    • Images

    • Links

    • Forms


4. HTML Elements

An HTML element usually has:

<tagname>Content</tagname>

Example:

<p>This is a paragraph</p>
  • <p> → opening tag

  • </p> → closing tag

  • Content → text between tags


5. HTML Tags

Tags tell the browser how to display content.

Common tags:

<h1>Heading</h1> <p>Paragraph</p> <a>Link</a> <img>

⚠️ Some tags don’t need closing tags:

<img> <br> <hr>

6. HTML Comments

Comments are not displayed on the page.

<!-- This is a comment -->

Used for:

  • Explaining code

  • Debugging

  • Team collaboration


7. HTML Editors

You can write HTML using:

  • Notepad (basic)

  • VS Code (recommended)

  • Sublime Text

  • Atom

💡 Save HTML files with .html extension


8. HTML in Browser

  • Open .html file in any browser

  • Browser reads HTML and displays the webpage

  • Browsers ignore extra spaces & line breaks


9. Simple Example (Complete)

<!DOCTYPE html> <html> <head> <title>HTML Basics</title> </head> <body> <h1>Welcome</h1> <p>This page explains HTML basics.</p> </body> </html>

Key Points to Remember

✔ HTML builds structure
✔ Tags define content
✔ Browser interprets HTML
✔ Always start with <!DOCTYPE html>

Comments

Popular posts from this blog

Structure of HTML