"Hello, World!" in HTML

#hello-world #html

Written by Anders Marzi Tornblad

How to do "Hello, World!" in HTML5.

<!-- hello-world.html -->
<!doctype html>
<title>Hello, World!</title>
<p>Hello, World!

Most of the structure of an HTML document, including the html, head and body elements, can be left out without invalidating the document. Also, most block-level elements are self-closing. For instance, the segment <p>Hello<div>World is perfectly equivalent to <p>Hello</p><div>World</div>, which can sometimes be unintuitive, especially in combination with CSS or the querySelector function.

For more "Hello, World!" examples, go to the Hello World category.