Skip to content
PotatoScript edited this page Apr 2, 2025 · 1 revision

πŸ“Œ 1. HTML Basic Structure

Every HTML file must follow a specific structure.

πŸ“Œ A simple HTML document looks like this:

<!DOCTYPE html>
<html>
<head>
    <title>My First Web Page</title>
</head>
<body>
    <h1>Hello, World!</h1>
    <p>This is my first web page.</p>
</body>
</html>

πŸš€ Let’s break it down! πŸ‘‡


🟒 2. HTML Doctype (<!DOCTYPE html>)

πŸ“Œ The first line of every HTML file is always:

<!DOCTYPE html>

βœ… This tells the browser:

"Hey! This is an HTML5 document!"

πŸ’‘ Without this line, the browser might not understand how to correctly display your page.


🟒 3. The <html> Tag

πŸ“Œ The <html> tag is the biggest container for your entire webpage.

<html>
    <!-- Everything inside here is part of the webpage -->
</html>

βœ… Everything inside <html> is read by the browser to display the page.

πŸ’‘ It must have an opening (<html>) and a closing (</html>) tag.


🟒 4. The <head> Section

πŸ“Œ The <head> tag contains important information about the page but does not appear on the webpage itself.

<head>
    <title>My Website</title>
</head>

βœ… The head section is like a brain 🧠. It includes:

  • <title> β†’ The title of the webpage (shows on the browser tab).
  • Other settings (like fonts, styles, and scripts).

πŸ’‘ Example:

<head>
    <title>Awesome Website</title>
    <meta charset="UTF-8">
</head>
  • The <meta charset="UTF-8"> ensures the page supports all languages 🌍 (English, Japanese, Arabic, etc.).

🟒 5. The <body> Section

πŸ“Œ The <body> tag contains everything that will be displayed on the webpage.

<body>
    <h1>Welcome!</h1>
    <p>This is my first webpage.</p>
</body>

βœ… Inside <body>, we can have:

  • Headings (<h1> to <h6>)
  • Paragraphs (<p>)
  • Images (<img>)
  • Links (<a>)
  • Buttons (<button>)
  • Videos (<video>)

πŸ’‘ Example:

<body>
    <h1>🌟 My Awesome Website 🌟</h1>
    <p>Welcome to my first website!</p>
    <img src="https://example.com/image.jpg" alt="Cute cat" width="200">
    <a href="https://google.com">Go to Google</a>
</body>

🟒 6. HTML Tags & Their Uses

πŸ“Œ HTML uses "TAGS" to structure content.

πŸ“ Basic format of an HTML tag:

<tagname>Content</tagname>

βœ… Opening tag β†’ <p>
βœ… Closing tag β†’ </p>


🟒 7. Example of HTML Elements

Here are some common HTML elements with examples:

Tag Purpose Example
<h1> - <h6> Headings (titles) <h1>Big Title</h1>
<p> Paragraph <p>This is text.</p>
<a> Hyperlink <a href="https://google.com">Google</a>
<img> Image <img src="cat.jpg" alt="A cute cat">
<ul>, <li> Unordered List <ul><li>Item 1</li></ul>
<ol>, <li> Ordered List <ol><li>First</li></ol>
<table> Table <table><tr><td>Data</td></tr></table>

🟒 8. Full Example: Simple Web Page

πŸ“Œ Let’s put everything together into a full HTML page!

<!DOCTYPE html>
<html>
<head>
    <title>🌍 My First Web Page</title>
</head>
<body>
    <h1>πŸš€ Welcome to My Website! πŸš€</h1>
    <p>Hello! This is my first webpage.</p>
    
    <h2>πŸ“Έ My Favorite Image:</h2>
    <img src="https://example.com/cute-cat.jpg" alt="A cute cat" width="200">
    
    <h2>πŸ”— Useful Links:</h2>
    <a href="https://google.com">Click here to go to Google</a>

    <h2>πŸ“‹ My To-Do List:</h2>
    <ul>
        <li>Learn HTML</li>
        <li>Practice CSS</li>
        <li>Build a website</li>
    </ul>
</body>
</html>

βœ… What happens when you open this file?

  • Title: β€œπŸŒ My First Web Page” appears on the browser tab.
  • Big heading: "πŸš€ Welcome to My Website! πŸš€"
  • Paragraph: "Hello! This is my first webpage."
  • An image of a cat 🐱
  • A link to Google πŸ”—
  • A to-do list πŸ“

Clone this wiki locally