Until everyone agrees on universal standards, there will be different tags that accomplish the same things, so be sure to always use the shorter tag to get the job done. Here's a quick list:
- Use <B> instead of <STRONG> to achieve boldness.
- Use <I> instead of <EM> to achieve italic.
- Use <CENTER> instead of <DIV ALIGN=center> to center an element.
- Use <BIG> instead of <FONT SIZE="+1"> to make text one step bigger.
- Use <SMALL> instead of <FONT SIZE="-1"> to make text one step smaller.
- Use <TT> instead of <CODE> or <SAMP> to make text monospaced.
Here's another one that sounds obvious. Don't repeat your HTML unless absolutely necessary. An example:
<FONT FACE=Arial SIZE=2 COLOR=green>
<P>This is one paragraph.</P>
</FONT>
<IMG SRC="picture.gif" HEIGHT=10 WIDTH=20>
<FONT FACE=Arial SIZE=2 COLOR=green>
<P>This is a second paragraph.</P>
</FONT>
Why use the same <FONT> tag twice? Try this instead:
<FONT FACE=Arial SIZE=2 COLOR=green>
<P>This is one paragraph.</P>
<IMG SRC="picture.gif" HEIGHT=10 WIDTH=20>
<P>This is a second paragraph.</P>
</FONT>
This trick is related to the previous one and is also best illustrated with an example:
<FONT FACE=Arial SIZE=2>
This paragraph has one
</FONT>
<FONT FACE=Arial SIZE=2 COLOR=red>
red
</FONT>
<FONT FACE=Arial SIZE=2>
word.
</FONT>
Instead of closing and opening the complete <FONT> tag each time, simply nest one <FONT> within another <FONT> - for example :
<FONT FACE=Arial SIZE=2>
This paragraph has one
<FONT COLOR=red>
red
</FONT>
word.
</FONT>
Much tidier. But we can get our tags even cleaner by only using attributes when necessary.
next page»