HTML (HyperText Markup Language) is the foundation of web development. It is used to structure the content of a webpage using various elements and tags.
1. What is HTML?
HTML is a markup language that defines the structure of web pages.
It consists of elements represented by tags such as <p>, <h1>, <a>, etc.
Web browsers interpret HTML and display the content visually.
2. Basic Structure of an HTML Document
Every HTML page follows a standard structure:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My First Webpage</title>
</head>
<body>
<h1>Welcome to Web Development</h1>
<p>This is a paragraph of text.</p>
</body>
</html>Explanation of the Structure:
<!DOCTYPE html> defines the document type as HTML5.
<html> is the root element that wraps all content.
<head> contains metadata like character encoding and page title.
<title> sets the name of the webpage, which appears in the browser tab.
<body> holds the visible content of the webpage.
3. Common HTML Tags and Their Uses
Headings (<h1> - <h6>) → Used to define headings, where <h1> is the largest and <h6> is the smallest.
Paragraph (<p>) → Represents a block of text.
Links (<a href="URL">) → Creates hyperlinks to other web pages or resources.
Images (<img src="image.jpg" alt="Description">) → Embeds images into the webpage.
Lists (<ul>, <ol>, <li>) → Used to create unordered (<ul>) and ordered (<ol>) lists.
Tables (<table>, <tr>, <td>) → Creates structured data tables.
Forms (<form>, <input>) → Collects user input such as text, emails, and passwords.
4. Practical Task: Create a Simple Webpage
Now, let’s build a simple personal profile page using what we’ve learned.
Task: Create a Personal Profile Page
Follow these steps:
Open a text editor (like VS Code or Notepad++).
Create a new file and save it as index.html.
Copy and paste the following code into the file.
Open the file in a browser to see the output.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Profile</title>
</head>
<body>
<h1>Welcome to My Profile</h1>
<p>Hello! My name is John Doe. I'm learning web development.</p>
<h2>My Hobbies</h2>
<ul>
<li>Coding</li>
<li>Reading</li>
<li>Traveling</li>
</ul>
<h2>Contact Me</h2>
<p>Email: <a href="mailto:john@example.com">john@example.com</a></p>
</body>
</html>
5. Next Steps:
Modify the page by adding your own details.
Experiment with adding an image using the <img> tag.
In the next lesson, we’ll explore HTML Forms and Semantic Elements to improve webpage structure.
Web Development Best Resources
Share with credits: https://t.me/webdevcoursefree
ENJOY LEARNING 👍👍