SEARCH HERE

Tuesday, February 3, 2026

📘DAY 3: HTML BASIC EXAMPLE

 

📘 DAY 3: HTML BASIC EXAMPLE – 


1️⃣ What is an HTML Basic Example?

An HTML Basic Example is a simple HTML program that shows:

  • How HTML code is written

  • How tags are used

  • How a webpage is displayed in a browser

This is the first real HTML program for beginners.


2️⃣ First HTML Basic Example

Below is a basic HTML example:

  • <!DOCTYPE html>

  • <html>

  • <head>

  •     <title>My First HTML Page</title>

  • </head>

  • <body>


  •     <h1>Welcome to HTML</h1>

  •     <p>This is my first HTML web page.</p>


  • </body>

  • </html>




3️⃣ Explanation of the Example (Line by Line)

🔹 <!DOCTYPE html>

  • Declares the document type

  • Tells browser this is HTML5

  • Must be written at the top


🔹 <html>

  • Root element of HTML page

  • Wraps entire HTML content


🔹 <head>

  • Contains metadata

  • Not visible on webpage

  • Includes title, meta tags, links


🔹 <title>

  • Displays text on browser tab

  • Important for SEO

Example:

  • My First HTML Page



🔹 <body>

  • Visible part of the webpage

  • All content shown to user is inside <body>


🔹 <h1>

  • Heading tag

  • Used for main heading

  • <h1> is the largest heading


🔹 <p>

  • Paragraph tag

  • Used to display normal text


4️⃣ Output of the HTML Example

When opened in browser, output will be:

  • Welcome to HTML

  • This is my first HTML web page.



5️⃣ Important Points About HTML Basic Example

✔ HTML code is read top to bottom
✔ Browser ignores extra spaces and lines
✔ Tags define structure, not appearance


6️⃣ Saving the HTML File (Very Important)

Steps:

  1. Open Notepad / VS Code

  2. Paste HTML code

  • Save file as:
    index.html


  1. Save type: All Files

  2. Encoding: UTF-8

  3. Open in browser


7️⃣ HTML Basic Rules

✔ HTML files use .html extension
✔ Tags should be properly closed
✔ Use lowercase tags (best practice)
✔ Indentation improves readability


8️⃣ Indented HTML Code (Best Practice)

  • <!DOCTYPE html>

  • <html>

  •   <head>

  •     <title>HTML Example</title>

  •   </head>

  •   <body>

  •     <h1>Hello</h1>

  •     <p>Welcome to HTML</p>

  •   </body>

  • </html>

👉 Indentation does not affect output, only readability.


9️⃣ Common Beginner Mistakes

❌ Missing closing tags
❌ Forgetting <!DOCTYPE html>
❌ Saving file as .txt
❌ Writing content outside <body>


🔟 Practice Task

✔ Create an HTML file
✔ Add one heading
✔ Add one paragraph
✔ Change the title text
✔ Open in browser


1️⃣1️⃣ Interview / Viva Questions

  1. What is an HTML basic example?

  2. Why do we use <!DOCTYPE html>?

  3. What is the use of <title>?

  4. Which part of HTML is visible?

  5. Can HTML run without <head>?


1️⃣2️⃣ Summary

  • HTML basic example shows page structure

  • <html>, <head>, <body> are essential

  • Browser displays only body content

  • This is the foundation of HTML

https://www.tutorialspoint.com/html/images/html_basic_tags.jpg


0 comments:

Post a Comment

C++

AJAVA

C

E-RESOURCES

LKG, UKG Live Worksheets

Top