HTML code creates the structure of web pages. It uses tags to define elements like text, images, and links. You'll need a text editor and web browser to begin.
HTML (HyperText Markup Language) uses opening and closing tags to create elements. Browsers read these tags to display content properly. For example, <p>This is a paragraph</p> tells the browser to display text as a paragraph.
HTML consists of several key components:
Every HTML document starts with a basic structure:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
Open a text editor and type the following code:
<!DOCTYPE html>
<html>
<head>
<title>Simple Page</title>
</head>
<body>
<h1>Welcome to My Page</h1>
<p>This is my first HTML page.</p>
</body>
</html>
Save the file with a .html extension (e.g., index.html). Open it in a web browser to see your page.
Many beginners confuse HTML with other languages or make syntax errors. Remember:
| Mistake | Correction |
|---|---|
| Using lowercase and uppercase tags inconsistently | Always close tags in the same case they were opened |
| Forgetting to close tags | Every opening tag needs a closing tag (except void elements like <img>) |
| Mixing HTML with JavaScript or CSS | Keep HTML separate from other languages until you're comfortable with basics |
When I first started learning HTML, I created a simple personal profile page with my name, a photo, and a brief bio. This small project helped me understand how different HTML elements work together to create a complete webpage.