Creating Your First HTML Page

Open your text editor and type the following code. You don’t have to understand what any of it means at this point. This simple example is just to get you started.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/transitional.dtd">
<html>
<head>
<title>My Sample HTML Page</title>

</head>
<body>
<h1>This is my first title</h1>
<p>This is my first webpage paragraph bla bla!</p>
</body>

</html>
Note that the<!DOCTYPE> tag in the previous example doesn’t appear in lowercase like the rest of the tags. This tag is an exception to the XHTML rule and should appear in uppercase. In fact, you don’t have to specify a DOCTYPE at all to get your pages to work. The purpose of the DOCTYPE is to tell validators and browsers which specification your page was written to. It will be included in all examples, but you can leave them out if you like.

After you create your HTML file, save it to your hard disk. Remember that the best way to learn is to type your code and use a simple text editor such as Notepad but if you’re using a word processor like Microsoft Word, choose Save As and make sure that you’re saving it as “Text Only”. When you choose a name for the file, follow these two rules:

  • The filename should have an extension of .html (.htm on DOS or Windows systems that support only three-character extensions)for example, myfile.html, text.html, or index.htm. Most web software requires your files to have these extensions, so get into the habit of doing it now. (If you are using Windows, make sure that your computer is configured to show file extensions. If it isn’t, you’ll find yourself creating files named things like myfile.html.txt, which your browser will not think are HTML files.)
  • Use small, simple names. Don’t include spaces or special characters (bullets, accented characters) just letters and numbers are fine.
Viewing the Result

Now that you have an HTML file, start your web browser. You don’t have to be connected to the Internet because you’re not going to be opening pages at any other site. Your browser or network connection software might complain about the lack of a network connection, but you should be able to work offline.

Text Formatting and HTML

When an HTML page is parsed by a browser, any formatting you might have done by handthat is, any extra spaces, tabs, returns, and so onis ignored. The only thing that specifies formatting in an HTML page is an HTML tag. If you spend hours carefully editing a plain text file to have nicely formatted paragraphs and columns of numbers but don’t include any tags, when a web browser loads the page, all the text will flow into one paragraph. All your work will have been in vain.

The advantage of having all white space (spaces, tabs, returns) ignored is that you can put your tags wherever you want. The following examples all produce the same output. Try them!.

Filed under HTML XHTML And CSS. You can follow any responses to this entry through the RSS 2.0. You can leave a response by filling following comment form or trackback to this entry from your site

HTML XHTML And CSS' CATEGORY »

Introduction to HTML
From HTML To XHTML
Inside An HTML File
Creating Your First HTML Page
Intergrate CSS

No Responses for “Intergrate CSS”

  1. Geb says:

    genuinely a fantastic post. I will definitely be reading this blog more.

Leave a Reply