Beginning HTML - Home
Introduction - What is HTML, What it can do, what you'll need, etc. The Basics - First steps in HTML. Moving On - Further concepts. Advanced - More advanced ways to use HTML. Glossary - Explanation of terms used in this site HTML Tag and attribute reference - look up the most popular tags and their common attributes for reference
Square The Basics
square What are tags?
Square Making a first page
Square Basic formatting
Square Fonts-color and size
Square Styling your text
Square Writing 'good' HTML
Square Adding comments
 
Nesting tags
Uppercase or lowercase?
Make it readable!

HTML is a very forgiving language. That is, even if you aren't strict when you write HTML, miss out a few closing tags here and there and so on, many browsers will still either display the page or at least try their best to display it.
Therefore, it's quite easy to be 'lazy' and write sloppy code. This is a bad idea for two reasons - firstly, you'll never learn properly that way, and secondly (more importantly), some browsers, especially newer ones like Netscape 6, will not display badly written code as you expected it, or in many cases won't display it at all.

Nesting tags

Something that's especially important is the idea of nesting your tags correctly. It's important that your documents are structured well. Nesting means to close your tags in the correct order. The last tag to be opened should be the first tag to be closed.
For example, suppose you have a section of text that is both bold and italicized - like this . This requires two tags - one to make the text bold (<b>) and one to make it italicized (<i>). The correct way to do this would be either -

<b><i>Some text here</i></b>

or

<i><b>Some text here</b></i>

The wrong way to do this would be -

<b><i>Some text here</b></i>

or

<i><b>Some text here</i></b>

Remember that the first tag to be opened should be the last one to be closed!

Uppercase or lowercase?

HTML is a case insensitive language. This means you can write your pages in either UPPERCASE letters, lowercase letters, or even a mix of both! This means that the code

<font color="red">

Is really the same as the code -

<FONT COLOR="RED">

or even -

<fOnT cOlOr="ReD"

It's a good idea to decide to write in either lowercase or uppercase. Some people find it easier, when learning HTML, to write in uppercase, as it makes the code, or tags, stand out better from the page content in their documents.
Most HTML is written in lowercase, however, and this is considered good practice. Use whatever you feel happiest with.

Make it readable!

It's a very good idea when you're writing your HTML to make the code as readable as possible. One easy way of doing this is to use indents. All this means is to insert spaces in the code to make it appear more readable. This becomes more important as you start to write more complicated pages. For example, the code -

<table><tr><td>Example</td></tr></table>

would be far more legible, or readable, written like this -

<table>
 <tr>
  <td>
  Example
  </td>
 </tr>
</table>


Remember that any whitespace in your HTML is ignored by the browser. This gives you the freedom to structure and indent your documents how you like, or how you (or other people might) find them easier to read.
Perhaps the most important thing is that you can understand and read your code easily and efficiently. Try and develop your own style that you feel comfortable with.

Right, now we'll just take a quick look at using comments in our code, and then we'll move on and get our hands dirty in Section Three.

TopTop of page - BackBack to styling your text - Next - Using commentsNext

Introduction - The Basics - Moving On - Advanced - Glossary - Reference