HTML Tutorial

What is HTML?

HTML (HyperText Markup Language) is a language used to create and display web pages. It is the foundation of the World Wide Web, allowing users to easily access and interact with online content.

Key Concepts:

  • HTML Documents: Web pages are stored as HTML documents, which are text files that contain the content and structure of the page.
  • Elements: HTML is composed of elements, which are blocks of content that define how the page is displayed.
  • Tags: Tags are used to create elements, and each tag consists of an opening tag (<tag>) and a closing tag (</tag>).

Practical Steps:

To create a simple HTML page:

  1. Open a text editor (such as Notepad or TextEdit).
  2. Type the following code: <html><body><h1>Hello, World!</h1></body></html>
  3. Save the file with the extension ".html" (e.g., "my_page.html").
  4. Open the HTML file in a web browser (such as Chrome or Safari) to view the page.

Overview of HTML

HTML provides a structured way to define the content and layout of a web page. It uses tags to create different types of elements, such as headings, paragraphs, lists, and links. By organizing content into elements, HTML makes it easier for browsers to interpret and display web pages consistently.

Example:

The following HTML code demonstrates a simple web page with a heading and a paragraph:

<!DOCTYPE html>
<html>
<head>
  <title>My Web Page</title>
</head>
<body>
  <h1>Welcome to My Web Page!</h1>
  <p>This is a paragraph of text.</p>
</body>
</html>

This code creates a web page with the title "My Web Page". It includes a heading ("Welcome to My Web Page!") and a paragraph of text ("This is a paragraph of text."). When viewed in a web browser, this HTML code will display a simple web page with these elements.