HTML Tutorial

Step 8: Extra HTML Stuff

HTML Comments

So far we've seen how to place many different content types on the web. When your HTML documents start getting large, it can be hard to remember what each section of code was supposed to be doing. Using comments you can leave notes for yourself inside your HTML code. Comments are ignored by web browsers and will not be displayed on your webpage. You can place any text you like inside a comment using a special tag that begins with <!-- and ends with -->. Here's a quick example.

The Code

<!-- This is a comment -->
<html>
   <body>
   <!-- Another 
   comment! -->
	
      This text is actually displayed.
   </body>
</html>

The Result

Character Entities

This tutorial has explained how to use HTML tags to declare many different HTML elements. These tags were denoted with the less than and greater than signs: < and >. What if you have a case where you need to display those characters within a webpage? (Like if you're writing an HTML tutorial!) One way to do it is with character entities.

Character entities are a way to display characters that are reserved for special purposes by HTML or simply aren't easily found on most keyboards. These entities use special strings - several characters strung together - to represent those troublesome missing characters. Here's a small table with some of the most useful character entities.

CharacterEntity CharacterEntity CharacterEntity
 &nbsp; "&quot; ¢&cent;
<&lt; '&apos; £&pound;
>&gt; ×&times; ©&copy;
&&amp; ÷&divide; ®&reg;

Forms

It's possible to create HTML forms that take in information from someone viewing your webpage. The persone viewing your webpage could be prompted to enter text, select options from a set of choices, and then click a button to submit those choices.

Yet, HTML will only set up the form in your webpage. It's only meant as a way to identify different types of content and so has no ability to handle any input itself. For that we need a more powerful language like Javascript or Java. Since we'll be learning Java a little later in the course (and it has it's own way to make forms) we'll skip HTML forms here.

Frames

One more topic that is being skipped in this tutorial is that of HTML frames. This technique would allow you to display multiple HTML documents inside the same browser window. Each displayed document would then be referred to as a frame.

At first glance, frames seem like a good idea. You can display more content and, because each frame would scroll separately, you can let one frame hold navigation links while the other displays your website's content. Using frames creates many problems, though. The extra layer of complexity gives you more to keep track of (and it's easier to mess up). Frames can create more complexity for people viewing your site as well - an easy way to cause people to lose interest in your website.

Since frames places multiple documents inside a single browser window, it's hard for users to remember or bookmark specific HTML documents on your website (or for other sites to link to yours). Finally, frames are not fully supported for very old web browsers, devices other than desktop computers that can now surf the web, and for anyone needing special programs to assist with viewing webpages (such as the visually impaired). For all these reasons, frames are not covered in this tutorial and their use is not encouraged in general.

Better Left to CSS

The purpose of HTML is to identify different parts of your webpage document. HTML is responsible for handling the content of your webpage. It is not really intended to handle the details of the presentation of that content. That's a job best left for CSS. (Which we'll learn just a little bit later!) Back in the old days before CSS (oh, just a few years ago) HTML had to try handling presentation on its own. This tutorial has left out these aspects, including using HTML for page layout, text formatting, colors, and backgrounds. We'll handle these in the CSS tutorial.


<< Step 7 << >> Step 9 >>