Let's try a simple HTML5 document named hello.html. This document shows the message Hello World in the web browser: Hello Document:
<!DOCTTYPE html>Select the code to copy and paste it onto Notepad++ as illustrated here:
<!--Example 1: Hello.html -->
<html>
<head>
<title> Hello example </title>
</head>
<body>
<p> Hello World! </p>
</body>
</html>
Click on Run and then select the broweser:
The rendered HTML document looks like this:
Congrats! Now you can save your first example on your computer by clicking on
File and then Save as Hello.html
DOCTYPE stands for document type declaration and it instructs browsers to render the page with the latest standards mode. The symbols <!-- and --> are used to start and end comment line. The head section includes information about the HTML5 document. For example the character set known as UTF-8 which is the most widely used encoding type for the web to enable the browser to render content.
The head section also includes special document-formating instructions known as CSS3 style sheets and other client-side programs known as scripts to incorporate dynamic web pages. The body section includes whatever the browser should display whenver the web page is visited.
The start element and end element are used to delimit the begining and the end of a section. For example the section head starts with <head> and ends with </head>. Attributes have names and values. For example the attribute bgcolor is assigned a color code. The elements <p> and </p> are used to type paragraphs.
There are many validation services such as validator.w3.org are used to verify that HTML5 documents are syntactically correct.