HTML Dasar : Hello World! (2/13)

2 min read 4 months ago
Published on Aug 31, 2024 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

In this tutorial, you will learn how to create your first simple website using HTML. We will build a "Hello World" webpage using Notepad on Windows. This foundational skill is essential for anyone interested in web development, as HTML is the backbone of all web content.

Step 1: Open Notepad

  • Click on the Start menu.
  • Type "Notepad" in the search bar and open the application.

Step 2: Write Your HTML Code

  • In the Notepad window, type the following HTML code:
<!DOCTYPE html>
<html>
<head>
    <title>Hello World</title>
</head>
<body>
    <h1>Hello World!</h1>
</body>
</html>

Explanation of Code

  • <!DOCTYPE html>: Declares the document type and HTML version.
  • <html>: The root element of the HTML page.
  • <head>: Contains meta-information about the document, such as the title.
  • <title>: Sets the title of the webpage that appears in the browser tab.
  • <body>: Contains the content of the webpage.
  • <h1>: Defines the main heading of the page, displaying "Hello World!".

Step 3: Save Your HTML File

  • Click on "File" in the top menu and select "Save As."
  • In the "Save as type" dropdown, select "All Files."
  • Name your file index.html and choose a location to save it, like your Desktop.
  • Click "Save."

Step 4: Open Your HTML File in a Web Browser

  • Navigate to the location where you saved index.html.
  • Right-click on the file and select "Open with."
  • Choose your preferred web browser (e.g., Chrome, Firefox).

Step 5: View Your Webpage

  • Your browser should display the webpage with the message "Hello World!" in large text.

Practical Tips

  • Always remember to save your changes in Notepad before refreshing your browser to see updates.
  • Use proper naming conventions for your files to avoid confusion.

Common Pitfalls to Avoid

  • Forgetting to save the file with a .html extension will prevent it from being recognized as an HTML document.
  • Ensure that your tags are properly opened and closed; otherwise, the browser may not render your page correctly.

Conclusion

Congratulations! You have successfully created your first HTML webpage displaying "Hello World." This is a fundamental step in web development, opening the door to more complex projects. Next, consider exploring additional HTML elements or CSS to enhance your web design skills.