Introduction to HTML
HTML (HyperText Markup Language) is the standard language used to structure the content of a web page. It is not a programming language but a markup language that describes the structure of a document.
Brief History
HTML was created in 1991 by Tim Berners-Lee and has evolved into the current version, HTML5, which adds support for multimedia, semantics, and more.
Basic Structure of an HTML Document
Every HTML file should follow a specific structure:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My First Page</title>
</head>
<body>
<h1>Hello World</h1>
<p>This is my first web page in HTML.</p>
</body>
</html>
Code Explanation
<!DOCTYPE html>: Indicates that HTML5 is being used.<html>: Root element of the document.<head>: Contains metadata, title, and links to resources.<body>: Contains the visible content of the page.
Best Practices
- Use
lang="en"to indicate the language. - Always define
<meta charset="UTF-8">to avoid encoding issues. - Keep the code properly indented for better readability.
Exercise
Create a file named index.html that displays your name in an <h1> header and a brief description in a paragraph.