https://blogger.googleusercontent.com/img/a/AVvXsEiSMQI0Y0bgvoi9-oax4riNNPXYEFbKMgFkQRz8gS3fGgK9T0tA1SBcvQeRG9DNSfJ1loeK6cL_xlN2ScJFX2mMekfEZ4KZHvPskdItBLK9y9WBVWwpskl-tct3LWbp-Zv3vLkcaKRmwoi50YJWX68ffdQ1ErQZVhP3ivaGC_fo0XGgHIvHmjsY3mHKBdU=s16000/
Published: Aug 28, 2024


For those just starting out in web development, 'Hello, World!' is the classic first project. In HTML, this simple phrase serves as your introduction to building websites.


What is HTML?

HTML, or Hypertext Markup Language, is the fundamental language for building web pages. HTML elements, like

<html>
,
<body>
, and
<h1>
, are the essential components of any website.


Setting Up Your Development Environment

Before we start, you'll need:

A Text Editor: You can use any text editor to write HTML code. Popular options include Visual Studio Code, Sublime Text, and Notepad++.

A Web Browser: Any modern web browser like Chrome, Firefox, or Edge will work. This is where you'll view the results of your HTML code.


Writing Your First HTML Code

Now, let’s write your first HTML document.

Open your text editor and create a new file. Save it with the .html extension, for example, hello_world.html.

Type the following code into your file:

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Hello, World!</title>

</head>

<body>

    <h1>Hello, World!</h1>

</body>

</html>


Breakdown of the Code

<!DOCTYPE html>
: This declaration defines the document type and version of HTML you're using. In this case, it's HTML5.

<html lang="en">
: This tag begins the HTML document. The lang="en" attribute specifies that the language of the document is English.

<head>
: This section contains meta-information about the document, such as its title and character set.

<meta charset="UTF-8">
: This specifies the character encoding for the HTML document, ensuring it can display any text correctly.

<meta name="viewport" content="width=device-width, initial-scale=1.0">
: This meta tag ensures your webpage displays correctly on different device screens. By using this meta tag, you ensure that your webpage looks and functions properly on all devices

<title>Hello, World!</title>
: The content inside the <title> tag appears in the browser tab when you open the webpage.

<body>
: This section contains the content of the webpage that will be visible to users.

<h1>Hello, World!</h1>
: This is the main heading of your webpage, and it will display "Hello, World!" in bold text.


Viewing Your HTML Page

Once you've written your code, it's time to view it in your web browser.

Save the file with the

.html
extension if you haven't already.

Open your file in a web browser. You can do this by double-clicking the file or right-clicking it and selecting "Open with" and then your preferred browser.

You should see a webpage with 'Hello, World!' displayed prominently on the screen.


Conclusion

You've successfully created your first HTML webpage! This is a great starting point for building more advanced web projects. Now, you can add more elements, style your page with CSS, or even make it interactive with JavaScript.

All you have to do is keep adding and experimenting with this web page you created to really start learning more and more. Try and see what you can turn your Hello, World! webpage into!

Feel free to copy this code into your own HTML files and play around with it. Web development is a vast field, and this "Hello, World!" is just the beginning!