Objective
By the end of this lesson, you’ll understand:
- What HTML is.
- Why it’s important.
- How to create a basic HTML document.
What is HTML?
HTML (HyperText Markup Language) is the standard language for creating web pages. It structures the content on the web, using elements like text, images, and links.
Why Learn HTML?
- It’s the foundation of web development.
- It’s beginner-friendly and easy to learn.
- It allows you to build and customize websites.
Basic HTML Structure
An HTML document is made up of elements. Here’s the structure:
<!DOCTYPE html> <html> <head> <title>My Page</title> </head> <body> <h1>Hello, World!</h1> </body> </html>
Explanation
<!DOCTYPE html>
: Tells the browser this is an HTML5 document.<html>
: The root element containing all HTML code.<head>
: Contains metadata and the title of the page.<title>
: Sets the page title visible in the browser tab.<body>
: Holds the main content of the page.<h1>
: Represents the main heading.<p>
: Represents a paragraph.
Activity
- Open a text editor (e.g., Notepad on Windows, TextEdit on Mac, or Visual Studio Code).
- Copy the example code above and save it as
index.html
. - Open the file in a browser to see your first web page.
Quiz
- What does
<!DOCTYPE html>
do?- a) Displays the page title.
- b) Tells the browser the HTML version.
- c) Adds a paragraph.
- d) Styles the content.
Summary
- HTML is the backbone of web pages.
- The structure includes elements like
<html>
,<head>
, and<body>
. - You can create your first web page with just a few lines of code.
Leave a Reply