Writing HTML Code Part 1

Previous Page    Next Page

To create basic code for an HTML page you need to use a simple text editor like Notepad++ which can be downloaded from, the basic code used for the HTML page is as follows:

At the top of the page is what is known as the document type or DTD further reading and explanation of DTD can be found at

Below that is the starting HTML tag <html> the rest of the code should be written in lowercase after the document type in order for it to validate with the W3C standards.

Here we are using the HTML 1.0 Transitional document type.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

The head section of the document is used to provide the search engines and the various browsers information about a given Web page, they help search engines categorize the web page correctly, the title section gives the page it's title in the case of the example Building Web Sites, this will appear at the top of the browser <title>Building Web Sites</title>.

The head section also includes the meta elements beginning with the content type this specifies which character encoding is being used on the page <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> followed by the language meta tag which indicates what language the page is written in/ the en indicating that English is the language used on the page <meta http-equiv="content-language" content="en">

Next is a description of the pages content <meta name="description" content="building web sites provides a free html and css tutorial of how to build a web site"> and below that is the keywords meta tag used to input keywords that can be found on the page such as headers and the keywords of the pages content <meta name="keywords" content="building web sites, web design, html tutorial, css tutorial, building a web site.">

The next meta tag is used to acknowledge the author of the web page <meta name="author" content=" phil lacey">, and finally in the head section of the document is a link to an external cascading style sheet which will give more control over the web site as it's being developed making it easier to make changes from one place <link rel="stylesheet" type="text/css" href="style.css">.

Some great tutorial sites for learning how to write code

The World Wide Web Consortium (W3C)

W3C Markup Validation Service

Previous Page    Next Page

Recommended Books