HTML Cheatsheet

HTML Cheatsheet

--------------------------------------------------------------------------------
Basic Tags
Creates an HTML document
CODE= <html></html>
Sets off the title and other information that isn't displayed on the Web page itself
CODE= <head> <title>The text you want bookmarked </title> </head>
Starts and Ends the area between which the main content that displays in the web browser body area
CODE= <body></body>

------------------------
Body Attributes
Sets the background color, using name or hex value
CODE= <body bgcolor=?>
Sets the background image for the page
CODE= <body background=?... image file name>
Sets the text color, using name or hex value
CODE= <body text=?>
Sets the color of links, using name or hex value
CODE= <body link=?>
Sets the color of followed links, using name or hex value
CODE= <body vlink=?>
Sets the color of links on click
CODE= <body alink=?>

------------------------
Text Tags
Creates preformatted text
CODE= <pre></pre>
Creates the largest headline
CODE= <hl></hl>
Creates the smallest headline
CODE= <h6></h6>
Creates bold text
CODE= <b></b>
Creates italic text
CODE= <i></i>
Creates teletype, or typewriter-style text
CODE= <tt></tt>
Creates a citation, usually italic
CODE= <cite></cite>
Emphasizes a word (with italic or bold)
CODE= <em></em>
Emphasizes a word (with italic or bold)
CODE= <strong></strong>
Sets size of font, from 1 to 7)
CODE= <font size=?></font>
Sets font color, using name or hex value
CODE= <font color=?></font>

------------------------
Links
Creates a hyperlink
<a href="URL"></a>

Creates a mailto link
CODE= <a href="mailto:EMAIL"></a>
Creates a target location within a document
CODE= <a name="NAME"></a>
Links to that target location from elsewhere in the document
CODE= <a href="#NAME"></a>

------------------------
Formatting
Creates a new paragraph
CODE= <p></p>
Aligns a paragraph to the left, right, or center
CODE= <p align=?>
Inserts a line break
CODE= <br>
Indents text from both sides
CODE= <blockquote>
CODE>> </blockquote>

Creates a definition list
CODE= <dl></dl>
Precedes each definition term
CODE= <dt>
Precedes each definition
CODE= <dd>
Creates a numbered list
CODE= <ol></ol>
Precedes each list item, and adds a number
CODE= <li></li>
Creates a bulleted list
CODE= <ul></ul>
A generic tag used to format large blocks of HTML, also used for stylesheets
CODE= <div align=?>

------------------------
Graphical Elements
Adds an image
CODE= <img src="name">
Aligns an image: left, right, center; bottom, top, middle
CODE= <img src="name" align=?>
Sets size of border around an image
CODE= <img src="name" border=?>
Inserts a horizontal rule
CODE= <hr>
Sets size (height) of rule
CODE= <hr size=?>
Sets width of rule, in percentage or absolute value
CODE= <hr width=?>
Creates a rule without a shadow
CODE= <hr noshade>

------------------------
Tables
Creates a table
CODE= <table></table>
Sets off each row in a table
CODE= <tr></tr>
Sets off each cell in a row
CODE= <td></td>
Sets off the table header (a normal cell with bold, centered text)
CODE= <th></th>

------------------------
Table Attributes
Sets width of border around table cells
CODE= <table border=#>
Sets amount of space between table cells
CODE= <table cellspacing=#>
Sets amount of space between a cell's border and its contents
CODE= <table cellpadding=#>
Sets width of table - in pixels or as a percentage of document width
CODE= <table width=# or %>
Sets alignment for cell(s) (left, center, or right)
CODE= <tr align=?> or <td align=?>
Sets vertical alignment for cell(s) (top, middle, or bottom)
CODE= <tr valign=?> or <td valign=?>
Sets number of columns a cell should span
CODE= <td colspan=#>
Sets number of rows a cell should span (default=1)
CODE= <td rowspan=#>
Prevents the lines within a cell from being broken to fit
CODE= <td nowrap>

------------------------
Frames
Replaces the <body> tag in a frames document; can also be nested in other framesets
CODE= <frameset></frameset>
Defines the rows within a frameset, using number in pixels, or percentage of w idth
CODE= <frameset rows="value,value">
Defines the columns within a frameset, using number in pixels, or percentage of width
CODE= <frameset cols="value,value">
Defines a single frame - or region - within a frameset
CODE= <frame>
Defines what will appear on browsers that don't support frames
CODE= <noframes></noframes>

------------------------
Frames Attributes
Specifies which HTML document should be displayed
CODE= <frame src="URL">
Names the frame, or region, so it may be targeted by other frames
CODE= <frame name="name">
Defines the left and right margins for the frame; must be equal to or greater than 1
CODE= <frame marginwidth=#>
Defines the top and bottom margins for the frame; must be equal to or greater than 1
CODE= <frame marginheight=#>
Sets whether the frame has a scrollbar; value may equal "yes," "no," or "auto." The default, as in ordinary documents, is auto.
CODE= <frame scrolling=VALUE>
Prevents the user from resizing a frame
CODE= <frame noresize>

------------------------
Forms
For functional forms, you'll have to run a CGI script. The HTML just creates the appearance of a form.
Creates all forms
CODE= <form></form>
Creates a scrolling menu. Size sets the number of menu items visible before you need to scroll.
CODE= <select multiple name="NAME" size=?></select>
Sets off each menu item
CODE= <option>
Creates a pulldown menu
CODE= <select name="NAME"></select>
Sets off each menu item
CODE= <option>
Creates a text box area. Columns set the width; rows set the height.
CODE= <textarea name="NAME" cols=40 rows=8></textarea>
Creates a checkbox. Text follows tag.
CODE= <input type="checkbox" name="NAME">
Creates a radio button. Text follows tag
CODE= <input type="radio" name="NAME" value="x">
Creates a one-line text area. Size sets length, in characters.
CODE= <input type=text name="foo" size=20>
Creates a Submit button
CODE= <input type="submit" value="NAME">
Creates a Submit button using an image
CODE= <input type="image" border=0 name="NAME" src="name.gif">
Creates a Reset button
CODE= <input type="reset">