Learn HTML β The Language of Websites!
HTML is like LEGO for websites! You build web pages using pieces called "tags". Letβs learn how!
What is HTML?
HTML stands for Hyper Text Markup Language.
π¨ Imagine this: You are building a LEGO house. Each LEGO block is a piece like a window, door, or wall. Similarly, HTML uses small pieces called tags to build a website!
π» HTML tells the computer: "This is a heading," "This is a picture," or "This is a link."
π§ Without HTML: A webpage would be empty and boring. No text, no images, nothing!
π οΈ Simple Example:
<h1>Hello! I am learning HTML!</h1> <p>HTML is super fun!</p>
β This will show:
Hello! I am learning HTML!
HTML is super fun!
β¨ Fun Fact: Every website you visit β Google, YouTube, games β all use HTML!
π― Goal for You: By learning HTML, you will be able to make your own web pages with text, pictures, and buttons. Just like magic but made by YOU! π©β¨
Basic HTML Page Structure
π¨ Think of a webpage like a book!
It has a cover, a title, and pages inside. HTML has a similar structure!
π Basic HTML Layout:
<!DOCTYPE html> β Tells the computer this is an HTML5 file. <html> <head> <title>My First Webpage</title> β Shows the name on browser tab. </head> <body> <h1>Hello, World!</h1> β Big heading on the page. <p>This is my first webpage.</p> β A paragraph. </body> </html>
π§ Understand the Parts:
- <!DOCTYPE html> β Says, "This is an HTML5 file."
- <html> β The start of the webpage.
- <head> β Hidden info like the title, styles, or scripts.
- <title> β The text that appears on the browser tab (not on the page).
- <body> β Where all the visible things go β headings, text, images, buttons.
π‘ Result on the Webpage:
Hello, World!
This is my first webpage.
π Tip: Every webpage starts and ends with <html>
and </html>
β just like opening and closing a book!
HTML Tags (Magic Words!)
Tags are like instructions. Each tag tells the browser what to do!
π Common & Fun Tags:
- <h1> ... </h1> β Biggest Heading (Title)
- <h2> ... </h2> β A bit smaller heading
- <h3> ... </h3> β Even smaller heading
- <p> ... </p> β Paragraph (text block)
- <img> β Image (shows pictures)
- <a> ... </a> β Link (click to go somewhere)
- <button> ... </button> β Button (click me!)
- <br> β Line break (move to the next line)
- <hr> β Horizontal line (divider)
- <ul> ... </ul> β Unordered list (with bullet points)
- <ol> ... </ol> β Ordered list (with numbers)
- <li> ... </li> β List item (used inside ul or ol)
- <div> ... </div> β A box or section
- <span> ... </span> β A tiny container for text
- <strong> ... </strong> β Bold text (important)
- <em> ... </em> β Italic text (emphasis)
- <video> ... </video> β Play a video
- <audio> ... </audio> β Play audio/music
π§ Example: Making a List of Fruits
<h2>My Favorite Fruits</h2> <ul> <li>Apple</li> <li>Banana</li> <li>Mango</li> </ul>
π This will show:
- Apple
- Banana
- Mango
π¬ Example: Adding a Video
<video controls> <source src="video.mp4" type="video/mp4"> Your browser does not support the video tag. </video>
π₯ This will show a video player!
HTML Headings
π Headings are like titles on your webpage. They help you show what's important!
HTML has 6 types of headings:
- <h1> β The BIGGEST heading (Main Title)
- <h2> β Second biggest
- <h3> β A little smaller
- <h4> β Even smaller
- <h5> β Tiny heading
- <h6> β The smallest heading
β¨ Example of Headings:
<h1>Welcome to My Website</h1> <h2>About Me</h2> <h3>My Hobbies</h3> <h4>I Love Drawing</h4> <h5>Sketches</h5> <h6>Tiny Text Example</h6>
π This will look like:
Welcome to My Website
About Me
My Hobbies
I Love Drawing
Sketches
Tiny Text Example
π‘ Tip: Always use <h1>
only ONCE on a page for the main title. Then use <h2>
to <h6>
for sections and smaller topics.
HTML Paragraphs
βοΈ A paragraph is how we write normal text on a webpage β like sentences or stories!
We use the tag <p> ... </p> to write paragraphs.
β¨ Example:
<p> Hello! My name is Alex. I love coding and drawing. </p>
π This will show like:
Hello! My name is Alex. I love coding and drawing.
π‘ Fun Fact:
You can make as many paragraphs as you want by using more <p> tags!
π¨ Example with Two Paragraphs:
<p>I love making websites.</p> <p>My favorite color is blue.</p>
π Looks like:
I love making websites.
My favorite color is blue.
π Tip: Always remember to open the tag with <p>
and close it with </p>
.
Adding Images in HTML
πΈ Want to show pictures on your webpage? You can use the <img> tag. It's like saying, "Hey browser, show this picture!"
β¨ The <img> tag needs:
- src β Where the image is (the file name or link)
- alt β Words that describe the image (helps when image doesn't load)
π§ Simple Example:
<img src="cat.png" alt="A cute cat">
π This will show a picture of a cat (if you have a file named cat.png in your folder).
π Example with Online Image:
<img src="https://example.com/dog.png" alt="A happy dog">
π¨ Example Output:
This is a cute cat image!
π‘ Important Tips:
- β Always add alt text. It helps if the picture doesnβt load.
- β Make sure the src is correct (file name or web link).
- β Images donβt need a closing tag. Just one tag like <img>.
Links in HTML
π Links are like magic doors. When you click them, they take you to another page or website!
We use the <a> tag (the 'a' means anchor).
It needs an href (Hyperlink REFerence) to tell where to go.
β¨ Simple Example:
<a href="https://www.google.com">Visit Google</a>
π This will look like:
π¨ Link to Another Page You Made:
<a href="about.html">About Me</a>
πΈ This will open your own page named about.html.
π‘ Add Target to Open in New Tab:
<a href="https://www.youtube.com" target="_blank">Go to YouTube</a>
π This will open YouTube in a new browser tab!
β Rules to Remember:
- Use <a>...</a> to create a link.
- href="..." is where the link goes.
- Text between the tags is what users click.
- target="_blank" opens the link in a new tab (optional).
Lists in HTML (Bullet & Number)
π Lists help organize things like favorite foods, tasks, or steps!
There are two main types of lists:
- Unordered List β Bullets (β’)
- Ordered List β Numbers (1, 2, 3...)
π Example of a Bullet List (Unordered List):
<ul> <li>Pizza</li> <li>Ice Cream</li> <li>Burger</li> </ul>
π It will look like:
- Pizza
- Ice Cream
- Burger
π§βπ³ Example of a Number List (Ordered List):
<ol> <li>Wake up</li> <li>Brush teeth</li> <li>Eat breakfast</li> </ol>
π It will look like:
- Wake up
- Brush teeth
- Eat breakfast
β Rules to Remember:
- Use <ul> for bullet lists.
- Use <ol> for numbered lists.
- Each item goes inside <li> (List Item) tags.
Tables in HTML
πͺ A table is like a grid where we can show information neatly in rows and columns. Think of it like your classroom seating chart or a timetable!
β¨ Basic Table Example:
<table border="1"> <tr> <th>Name</th> <th>Age</th> <th>Hobby</th> </tr> <tr> <td>Ava</td> <td>8</td> <td>Drawing</td> </tr> <tr> <td>Leo</td> <td>9</td> <td>Playing Football</td> </tr> </table>
π This looks like:
Name | Age | Hobby |
---|---|---|
Ava | 8 | Drawing |
Leo | 9 | Playing Football |
β What These Tags Mean:
- <table> β Starts the table
- <tr> β Table row (a line of boxes)
- <th> β Table heading (bold and centered)
- <td> β Table data (each box or cell)
π¨ You Can Also Add Borders and Styles!
<table border="1">...</table>
Or make it look fancy using CSS!
Simple Forms
β¨ A form is like a magic box where people can type information and send it! You see forms when you sign up, search, or send messages on websites.
π Example: A Simple Contact Form
<form> <label>Your Name:</label><br> <input type="text"><br><br> <label>Your Email:</label><br> <input type="email"><br><br> <label>Your Message:</label><br> <textarea rows="4" cols="30"></textarea><br><br> <button type="submit">Send Message</button> </form>
π This looks like:
π‘ What These Tags Mean:
- <form> β Starts the form
- <label> β Adds a label (a small text telling what to type)
- <input> β A box where you type
- type="text" β For writing words
- type="email" β For typing an email address
- <textarea> β A bigger box for writing longer messages
- <button> β A button to click
π¨ You Can Style Forms with CSS Too!
Make the form look colorful and pretty with backgrounds, borders, and buttons!
Adding Colors
Colors make websites look happy, bright, and fun! π
We can add colors using something called style.
ποΈ Example: Make Text Colorful
<p style="color: red;">I love coding!</p>
π This looks like:
I love coding!
π¨ Example: Change Background Color
<div style="background-color: yellow; padding: 10px;"> This has a yellow background! </div>
π Common Colors You Can Use:
- red
- blue
- green
- orange
- purple
- pink
- yellow
- black
π‘ Formula:
style="color: COLORNAME;" β Changes text color.
style="background-color: COLORNAME;" β Changes background color.
π― Try This:
<h1 style="color:blue;">Hello World!</h1> <p style="background-color:pink;">Welcome to my page.</p>
π¨ Fun Practice
Letβs try making your own mini webpage! π
π Mission: Make a Page About Your Favorite Animal!
<!DOCTYPE html> <html> <head> <title>My Favorite Animal</title> </head> <body> <h1 style="color:blue;">πΆ My Favorite Animal: Dog!</h1> <p>Dogs are friendly, smart, and love to play!</p> <img src="dog.png" alt="Cute Dog" width="200"> <p> Learn more about dogs on <a href="https://en.wikipedia.org/wiki/Dog" target="_blank">Wikipedia</a>. </p> <h2>Why I Love Dogs:</h2> <ul> <li>They are loyal πΎ</li> <li>They play fetch πΎ</li> <li>They give cuddles π€</li> </ul> <button>Pet the Dog! πΆ</button> </body> </html>
β What You Just Used:
- <h1>, <h2> β Big and medium headings
- <p> β Paragraph text
- <img> β Image
- <a> β Link to other websites
- <ul> <li> β A list of reasons
- <button> β A clickable button
β¨ Challenge:
Try changing the animal! π± π¦ π’ π§
Change colors, text, and try adding more lists or buttons!
π Bonus Idea:
Make a page about your favorite cartoon, fruit, or game!
π Cool Tips & Tricks
Want to make your webpage extra cool? Here are some simple tricks you can try! π
π¨ Add Color
Make your text colorful!
<h1 style="color:blue;">Hello World!</h1>
πΌοΈ Resize Images
Make images bigger or smaller.
<img src="cat.png" width="200">
π Open Links in New Tab
Make a link open in a new window or tab.
<a href="https://google.com" target="_blank">Visit Google</a>
π Line Breaks
Want text on a new line? Use:
Hello!<br> Welcome to my website!
π ±οΈ Bold & Italic Text
Make text bold or italic.
<b>I love coding!</b> <br> <i>HTML is fun!</i>
β¨ Emoji Power!
Add emojis anywhere in your text. Just copy-paste them!
<p>My favorite animal is πΆ</p>
π Bonus Tip:
Try mixing colors, emojis, and buttons together to make a super fun webpage!
π Learning Roadmap
Ready to become an HTML Superhero? π¦ΈββοΈπ¦ΈββοΈ Follow these steps to level up your skills!
- π Step 1: Learn What is HTML β Understand how webpages are made.
- π§± Step 2: Explore HTML Structure β How to build your webpage like LEGO blocks.
- π·οΈ Step 3: Master HTML Tags β Text, images, buttons, and links!
- π Step 4: Learn how to create Links & Tables β Connect pages and make info tables.
- π― Step 5: Do Fun Practice β Build mini projects like "My Favorite Animal" or "My Birthday Page."
- β¨ Step 6: Learn Cool Tips β Add colors, emojis, buttons, and magic!
- π Step 7: Build Your First Full Webpage β Put everything together!
- π Step 8: Share with friends and family β Show off your awesome work!
π Keep practicing and soon you'll be building amazing websites like a PRO!