Search for '{{search_term}}'

Hello World in plain HTML

CMOS is the Code-Maven Open Source podcast that also includes video interviews. Subscribe to this feed RSS feed with your Podcast listener app or via iTunes iTunes.

The first step in building web applications is to learn about HTML and the first thing there is to learn is to create an HTML file showing Hello World!.

Plain text as HTML

As you can read in the HTML Basics, even plain text can be considered to be "HTML". If we create a file with .html and open it with a web browser such as Firefox, Chrome, Opera, Safari, or even Internet Explorer, then the browser will try to do its best to display the content of the file as HTML.

Therefore the most simple solution is to create a file with .html and have the following content in it:

examples/html/hello_world.html

Hello World!
Try!

You can either click on the "try" link to see it working, or you can copy the content of the example and open it from your hard disk using the File/Open menu option of your browser.

HTML 5 skeleton

A better solution is to provide a full HTML5 skeleton.

examples/html/hello_world_html5.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport"
     content="width=device-width, initial-scale=1, user-scalable=yes">

  <title>Hello World!</title>
</head>
<body>
Hello World!

</body>
</html>
Try!

In this example we have "Hello World!" twice. The one in the title element is the one that is displayed on "tab" of the web browser or on the frame of the window showing the web browser.

The one inside the body element is the one that we usually see in the browser.

Comments

In the comments, please wrap your code snippets within <pre> </pre> tags and use spaces for indentation.
comments powered by Disqus