HTML Cheat Sheet
This cheat sheet describes the HTML that you are apt to use in forums, blogs, guestbooks and other web sites that allow basic HTML.
This is a list of HTML commands that you are likely to want to input into a blog or other form field:
| Tag | Example | Description |
|---|---|---|
| a | <a href="http://linksalive.com"> Description</a> | a stands for anchor tag. It is the most
important tag in HTML. You use it to create links between documents. To make
a link to the document, you need to enter the path to the destination.
Generally, I use the fully qualified URL to the destination (that is the URL
that appears in the address bar).
The anchor requires both a begin and end tag. The text between the tags is hot, and is often underlined. |
| img | <img src=my.gif height="100" width="100" alt="Picture of me" /> | The image tag lets you
display images. Images are generally in the format .gif, .jpg or .png. The
src attribute is the address of the picture. It is generally best to post
both the height and width of the picture (this speeds up the rendering of
pages.)
The <img> tag is a singleton. In HTML transitional, you do not need to have an end tag. In xhtml, you need an end tag. You can fake an end tag by ending a tag with a slash: e.g. <img /> |
| p | <p>text</p> | The paragraph is the main tag for page flow. |
| h1 | <h1>Heading One</h1> | You have six heading tags. You use the heading tags for creating outlines. |
| br | <br /> | The break tag ends a single line. Note, the <br> is a singleton. In xhtml you need to close the tag with a slash. Learn to write the break tag as <br /> and you will be happy. |
| b | <b>Bold</b> | The bold tag makes text bold. |
| em | <em>Emphasis</em> | The emphasis tag gives the text emphasis (Usually, it makes things italics. I decided, it would have a yellow background). |
| i | <i>italics</i> | The italics tag makes slanty characters. |
| blockquote | <blockquote>Quoted text</blockquote> | The blockquote tag is designed to offset quotes in the text. You will see that many people use blockquotes to indent text. However, it is better to use CSS to define indentation. You may notice that I defined the blockquote tag to draw a box around the quote. |
| pre | <pre>for (i=1;1<100;1++) { process(i); }</pre> | The preformatted tag lets you display computer code on a web page. You may have noticed that web browsers ignore white space (the line breaks and spaces in a document). The pre tag prints in a fixed length font and displays the white space. |
Tags to Avoid:
There is a large number of deprecated tags in HTML. Deprecated means they are no longer part of the official HTML definition, but are still supported by most browsers. These tags are not included in newer DTDs (document type definition). That they are invalid HTML.
Browsers are going to be very strict about HTML in the future. When you have invalid HTML in a document, the browser will go into "quirk mode" and your page display will be unpredictable.
- <font>: Newer DTDs require that you define the font in the Cascading Style Sheet (CSS)
- <center>: I miss this tag, but again, newer DTDs exclude it.
- <u>: To underline, you need to use a style sheet. Personally, I never used underline in web pages, since most people equate underlines with hyperlinks.
- <s>: Strikethrough...this was an easy way to show changes in a document. I will miss it.
Deprecated Parameters
The powers that be are also limiting the number of parameters that you can use. In general, the new think is removing any attribute that is remotely related to formatting. The following are a few of the tag attributes that will be removed from the HTML specification:
- border=??: Define the border in the CSS.
- align=???: I really miss this attribute. I would let you quickly center table elements and paragraphs. It is probably best to define a center class. In a crunch, you can use the attribute style="text-align: center" in lieu of align=center.
- bgcolor and color: More formatting commands.
- hspace, vspace: These attributes were replaced by margin.
- padding: The CSS padding command is one of the few actual improvements of CSS. With CSS you can get more specific with padding, and give values of top, right, bottom and left. (e.g. padding: 0px 4px 1px 2px;)
- link, vlink, alink: These formatting attributes for the body tag are gone as well.
If you need to include formatting, you might try your hand at inline CSS. To write inline CSS, you simply use the attribute style followed by the formatting commands. The following code will create a centered paragraph with a border of 1, red text on a yellow background:
<p style="text-align: center; border: 1px solid blue; background-color: yellow; color: red; padding: 2px 10px 2px 10px; margin: 0px 10% 0px 10%; font-family: script;"> This is some clever text. </p>This is some clever text.
Back to HTML ~~ Index ~~ Sponsors