Get Set: HTML Horse Sense - dummies

Get Set: HTML Horse Sense

People used to refer to common sense as “horse sense.” Most things about HTML fall under the realm of horse sense. After you see HTML tags a few times, most of the rules “feel right,” and you have little trouble remembering or using them most of the time. You will occasionally make mistakes, though; don’t be surprised to see that most of a document’s text is in italics because you forgot to add a </i> tag to end italics.

Basic HTML rules

Here are a few basic HTML rules and some “gotchas” to watch out for:

  • Most HTML tags work in pairs. For example, if you want some text to appear in bold, you have to put <b> at the front of the text that you want to have appear in bold, and you have to put </b> at the end of the text. (The slash, /, indicates that a tag is being turned off.) If you forget the </b> at the end, you can easily end up with a document that looks fine at the start but then switches to bold somewhere in the middle — and continues in bold all the way through to the end.
  • HTML tags are written in lowercase. Convention used to say you should put HTML tags in ALL CAPS so that they would stand out from the text they’re embedded in. However, newer standards specify lowercase for HTML tags.
  • HTML ignores paragraph symbols and tabs in your text. One of the most confusing things about HTML is that it ignores the paragraph markers created in your text when you press the Enter key, as well as tab characters. When displaying HTML, the browser automatically breaks lines to fit the current window size. And the browser makes a paragraph break only when it sees the paragraph tag, <p>, or some other tag that implies the start of a new line (such as a top-level heading tag, <h1>).
  • HTML needs you to put paragraph tags (<p>) between paragraphs. No matter how many times you hit Enter while typing your text, you don’t prevent the text from showing up as a big blob on your Web page unless you put paragraph tags (<p>) between paragraphs.
  • HTML ignores multiple paragraph tags (<p>). In trying to format your text — to get a bit of extra space before a header, or even up two columns of text — it’s natural to want to put in multiple paragraph tags to create some extra white space. No go — most browsers treat multiple paragraph tags (<p>) as a single tag! This makes it much harder to control spacing on your page.
  • Basic HTML looks different on different types of browsers. Basic HTML doesn’t give you much control over the appearance of your document. (Newer versions of HTML allow more control but aren’t supported by older versions of popular browsers.) Different browsers handle the same tags differently. For example, a top-level heading (specified by the <h1> and </h1> tags) may look larger in one browser than in another browser.
  • Some tags don’t work on some browsers. Some browsers (such as Netscape Navigator) support tags that other browsers can’t handle. You should therefore stick with basic tags to avoid the chance of giving users nasty surprises when they view your documents.
  • Users configure their browsers differently. As if the differences among different browser versions weren’t enough, users can configure their browsers differently. Users who have bigger monitor screens tend to look at documents in a bigger window. But because these users sit farther back from their big screens, they may also use larger font sizes to display text. Some users set their browsers to display all graphics as the page transmits; a few turn off graphics. All these idiosyncrasies can make your document look different to different users.