DEV Community

Max Lockwood
Max Lockwood

Posted on • Updated on • Originally published at maxlockwood.dev

How to write “Hello World” in HTML

Writing a simple "Hello World" programme is the first step in becoming familiar with a new language. The text-based approach for defining web-page layouts is HTML (Hypertext Markup Language).

Code

A simple boilerplate HTML code is supplied in the code below, and a single <h1> tag is used to write "Hello World" on the web page.

Any text editor can be used to create HTML files. To be identified as HTML files, the files must be stored with the .html or .htm extension.

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
          <meta name="viewport"
         content="width=device-width, initial-scale=1">
        <title>Hello!</title>
    </head>
    <body>
        <h1>Hello World!</h1>
    </body>
</html>
Enter fullscreen mode Exit fullscreen mode

Output

Once created, this file can be opened in any web browser.

This is what will be displayed in your browser:

H1 heading displayed in the browser

Yes, printing anything from a Web page is that simple. To run HTML code in a Web page, you don't need to compile it. Because HTML is a markup language, you can simply edit your code and hit the refresh button to see the changes immediately on your Web page.

Top comments (0)