Introduction to HTML

HTML stands for Hyper Text Markup Language An HTML file is a text file containing small markup tags The markup tags tell the Web browser how to display the page An HTML file must have an htm or html file extension An HTML file can be created using a simple text editor

Do You Want to Try It?If you are running Windows, start Notepad.

If you are on a Mac start SimpleText.

In OSX start TextEdit and change the following preferences: Open the the "Format" menu and select "Plain text" instead of "Rich text". Then open the "Preferences" window under the "Text Edit" menu and select "Ignore rich text commands in HTML files". Your HTML code will probably not work if you do not change the preferences above!

Type in the following text:

<html><head><title>Title of page</title></head><body>This is my first homepage. <b>This text is bold</b></body></html>

Save the file as "mypage.htm".

Start your Internet browser. Select "Open" (or "Open Page") in the File menu of your browser. A dialog box will appear. Select "Browse" (or "Choose File") and locate the HTML file you just created - "mypage.htm" - select it and click "Open". Now you should see an address in the dialog box, for example "C:\MyDocuments\mypage.htm". Click OK, and the browser will display the page.

Example ExplainedThe first tag in your HTML document is <html>. This tag tells your browser that this is the start of an HTML document. The last tag in your document is </html>. This tag tells your browser that this is the end of the HTML document.

The text between the <head> tag and the </head> tag is header information. Header information is not displayed in the browser window.

The text between the <title> tags is the title of your document. The title is displayed in your browser's caption.

The text between the <body> tags is the text that will be displayed in your browser.

The text between the <b> and </b> tags will be displayed in a bold font.

HTM or HTML Extension?When you save an HTML file, you can use either the .htm or the .html extension. We have used .htm in our examples. It might be a bad habit inherited from the past when some of the commonly used software only allowed three letter extensions.

Putting A Site Together Lately, I've been getting a lot of email asking about setting up a site with numerous internal pages. For example, let's say you create a homepage. We'll call it homepage.html. You then create three more pages:

At the moment they are just sitting on your hard drive (or floppy disc) and now you want them to become a site. Homepage.html will offer links to the three other pages. That'll be your first site. Good. Now, how do you do it?

The HREF Links First off, I'm assuming you already have a place to post these pages. So, now you have a place for your files. This "place" you have been given is actually a small section of a hard drive on a server somewhere. In computer terms, you have a directory where you can place your files. Think of this directory like an equal to a floppy disc. It's a contained area where the pages, and all the images that go on those pages will be housed. This is important to remember when you're writing the links that will connect these four pages together.

First off, let's attach to a page outside of your site. Here's the basic format:

<A HREF="http://www.p2plife.com">Click Here</A> Note the address above is a full URL. ("URL" stands for Universal Resource Locator. It's a fancy way of saying "web address") It starts with that http thing and ends with that .com deal. It's a full address.

Now let's look at what I call an internal link. This is a link that stays within your own site. One of your pages is calling for another one of your pages. We'll say this is a link from your homepage.html to links.html. Remember that from above? Here's the format:

<A HREF="links.html">Click Here</A> Notice I'm only calling for the page, without the full address attached. Why? Well, because I don't need it. To make the point a little stronger, let's look at the directory structure of web addresses.

Internal Links Now we put together a site in your own directory. Once again, you have a homepage called "homepage.html" and three sub-pages that you want to link to from homepage.html. They are "links.html," "photos.html," and "story.html". First off, you need to to FTP, or "upload" all four pages to your directory. Now, here's the first link on homepage.html that will call up your links.html page.

<A HREF="links.html">Click Here</A>

To Use Full URL, Or Not To Use Full URL If you are linking to a page off of your site, then you must use the full URL. The reason is that you are leaving your own directory. In fact, the chances are really good that you are leaving your server all together. Because of that, you need to offer your HREF command the full address to the new site. But when you're staying within your own site, as we are above, you need only call for the page name. You see, your directory is a closed home for all of your pages. If you only call for a page or an image through its name minus the full address, what happens is that the server looks for the page or the image inside the same home that houses the page that called for it. In other words, servers will search a page's home directory by default. That's good to know when you create your links. It means you only have to use the page's name minus the full URL.

What If I Do Use The Full URL? Always playing the rebel, huh? The answer is that your internal links might run slower. You see, if you use the full address, what happens is that when your user clicks on a link, a full search process begins. First the server is located, next the directory is located, then the page is located. Whereas, if you use only the name, the search is already at its destination. The server simply searches itself. Slick, huh?

The Home Page Links So what is written onto homepage.html to link the pages together? This:

I'm a beginner. I liked the simple way of explanation. Can u go ahead and explain certain other commands of HTML. Like putting in some text, picture and text with picture around it........... Thanks for the introduction This is first time on the site and I think I made a mistake, not sure though, may have posted this topic, as mine, but it is not. Ignore the mistake, I'm just a novice. Will learn, by and by.

HTML stands for Hyper Text Markup Language An HTML file is a text file containing small markup tags The markup tags tell the Web browser how to display the page An HTML file must have an htm or html file extension An HTML file can be created using a simple text editor

Do You Want to Try It?If you are running Windows, start Notepad.

If you are on a Mac start SimpleText.

In OSX start TextEdit and change the following preferences: Open the the "Format" menu and select "Plain text" instead of "Rich text". Then open the "Preferences" window under the "Text Edit" menu and select "Ignore rich text commands in HTML files". Your HTML code will probably not work if you do not change the preferences above!

Type in the following text:

<html><head><title>Title of page</title></head><body>This is my first homepage. <b>This text is bold</b></body></html>

Save the file as "mypage.htm".

Start your Internet browser. Select "Open" (or "Open Page") in the File menu of your browser. A dialog box will appear. Select "Browse" (or "Choose File") and locate the HTML file you just created - "mypage.htm" - select it and click "Open". Now you should see an address in the dialog box, for example "C:\MyDocuments\mypage.htm". Click OK, and the browser will display the page.

Example ExplainedThe first tag in your HTML document is <html>. This tag tells your browser that this is the start of an HTML document. The last tag in your document is </html>. This tag tells your browser that this is the end of the HTML document.

The text between the <head> tag and the </head> tag is header information. Header information is not displayed in the browser window.

The text between the <title> tags is the title of your document. The title is displayed in your browser's caption.

The text between the <body> tags is the text that will be displayed in your browser.

The text between the <b> and </b> tags will be displayed in a bold font.

HTM or HTML Extension?When you save an HTML file, you can use either the .htm or the .html extension. We have used .htm in our examples. It might be a bad habit inherited from the past when some of the commonly used software only allowed three letter extensions.