HTML 5

Chapter 5: Your First HTML Program

πŸ’» Chapter 5: Your First HTML Program

Let’s now write our first HTML page. This simple example will help you understand how a basic HTML document is structured and how each tag works.


βœ… Basic HTML Template

<!DOCTYPE html>
<html>
<head>
<title>Welcome to My Website</title>
<!-- This shows in the title bar or browser tab -->
</head>

<body>
<!-- Everything visible on the web page goes inside the body tag -->
</body>
</html>


πŸ” Explanation of Each Part

Code Part Description
<!DOCTYPE html> Declares the document type. It tells the browser that this is an HTML5 document. This must be the very first line of every HTML page.
<html></html> This is the root tag. Everything inside this tag is considered part of the HTML page.
<head></head> This section contains meta-information about the document. This includes the page title, links to CSS files, etc.
<title></title> This tag defines the title of the web page, which appears in the browser tab or window title.
<body></body> Everything you want to display on the web page (text, images, links, etc.) goes inside this tag.

🧠 Notes

  • Only the <title> tag is required inside the <head>.

  • HTML is not case-sensitive, but it’s best practice to write tags in lowercase.

  • Always use proper indentation to improve readability.


πŸ§ͺ Try It Yourself

Copy and paste the above code into a text editor (like Notepad or VS Code), save it as index.html, and open it in a browser. You’ll see an empty page, but the browser tab will show:
Welcome to My Website.

 

Leave a Reply

Your email address will not be published. Required fields are marked *