Encyclopedia > HTML tag

  Article Content

HTML tag

An HTML tag is a code used in the World Wide Web markup language HTML to denote the boundaries of an element, and, through its attribute values, set properties of that element. An element is usually a chunk of (marked-up) text: elements can contain other elements. For instance, the <em> tag tells the browser that a certain chunk of text is emphasized. A browser may render this emphasis by displaying the text in bold print on the screen, or by pronouncing it louder than normal text through the computer speakers. Elements that can contain other elements also have a corresponding "end" tag, which is identical to the opening tag except that it begins with a slash (i.e. </em> for the emphasis tag).

Whenever an attribute requires you to specify a color (such as a text or background color), there are two ways to do this. The more flexible of these is hexadecimal RGB notation. A hexadecimal RGB color consists of six hexadecimal digits. The first pair of these signifies the brightness of the red-light component of the color; the second pair, the blue-light component; the third, the green-light component. By combining different values, 16 million colors can be defined. For the benefit of anyone not comfortable with hexadecimal RGB notation, there exists a set of conventional color names: the sixteen names specified in HTML 4.01 are aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white(white), and yellow. (Many modern browsers recognise additional color names, but each browser recognises a different set, so a keyword recognised by one browser may be ignored - or displayed as a different actual color - by another.)

Table of contents

Basic tags

Delimits a HTML document (i.e. instead of an XML or another class document).

Delimits the header section of the document, which contains information about the page.

Delimits the body section of the document, which contains the displayed content of the page.

Header tags

The page title. Depending on the browser and the operating system it shows up at various places, such as in the browser's title bar. in the task bar when the window has been minimized, as default for the name of the file when saving the page, etc.

Body tags

The body tag

The parameters (values) are in hexadecimal (when a name is allowed, this is indicated below by also using names).

 <body ?>
Background color of page.

 <body background=?>
Background image for page. Images will tile to fill the whole screen.

 <body text=?>
Text color.

 <body link=?>
Color of links, also using names.

 <body vlink=?>
Color of visited links, also using names.

 <body alink=?>
Color of active links (e.g. a link that has just been clicked on), also using names.

Text appearance

Preformatted text. (Text will be displayed in a non-proportional font exactly as it is laid out in the file.)

 <h1></h1>, <h2></h2>, <h3></h3>, <h4></h4>, <h5></h5>, <h6></h6>
Section headings at different levels; by convention, higher-level headings are displayed larger than lower-level headings. (h1 is the highest level, h6 the lowest)

 <font size=?></font>
Sets font from 1 to 7.

 <font color=?></font>
Using names or hexadecimal.

In bold type.

In italics.

Typewriter (fixed-width) fonts.

 <em></em>, <strong></strong>
Emphasis (conventionally displayed in italics) and strong emphasis (conventionally displayed bold).

Paragraphs and lists

Delimits a paragraph.

 <p align=?>
Aligns a paragraph (left, center, right).

Inserts a line break.

Delimits a block quotation; conventionally displayed indented.

Delimits a definition list (consisting of definition terms paired with definitions).

Delimits definition term.

Delimits a definition.

Delimits an ordered (numerated) list.

Delimits an unordered list (with points, not numbers).

Delimits a list item in an ordered or unordered list.


 <a class=encyclopedia href="URL"></a>
Creates an hyperlink (i.e. to another part or another page, website...).

 <a class=encyclopedia href="mailto:EMAIL"></a>
To send a mail to an electronic address.

 <a class=encyclopedia href="news:newsgroup"></a>
Links to an usenet newsgroup ( using new:// links to a usenet server).

 <a class=encyclopedia href="ftp://ftpserver"></a>
Links to a FTP server (you can see more information in HTML).

 <a class=encyclopedia href="irc://irc.server.net:port/channel?key format"></a>
Links to an IRC server and/or channel (http://www.mirc.com/mirclink).

 <a name="NAME"></a>
Creates a link anchor inside the document.

 <a class=encyclopedia href="#NAME"></a>
Links to the specified anchor in the document.


 <img src="URL">
Includes an image.

 <img src="URL" align=?>
Aligns the image (left, right); text flows around aligned images.

 <img src="URL" border=?>
Specifies a border, ? pixels thick, to be drawn around the image.

Inserts a horizontal line.

 <hr size=?>
Inserts a horizontal line with a height (thickness) of ? pixels.

 <hr width=?>
Inserts a horizontal line with a width (length) of ? pixels.

 <hr noshade>
Inserts a flat horizontal line (many modern browsers give the horizontal line an embossed effect unless this parameter is specified).


Delimits a table

Delimits a row in the table.

Delimits a table header cell within a row; contents are conventionally displayed bold and centered.

Delimits a table content cell within a row. (Note: some browsers will not display an empty cell or a cell containing only spaces, instead displaying a rectangle of the appropriate size in the page's background color. This can be avoided by putting the &nbsp; element inside an "empty" cell.)

Table attributes

 <table border=#>

 <table cellspacing=#>
Sets the space in pixels between cells.

 <table cellpadding=#>
Sets the space in pixels between the cell border and content.

 <table width=#>, <table width=%>
Table width in pixels or as a percentage of browser pane width. (Although the table will display faster if a width is specified, this can usually better be avoided: then the browser determines what width is needed and what is available, depending on browser window width, font setting and word lengths.)

 <table align=?>
Horizontally align table on page (left, center, right).

 <tr align=?>, <td align=?>
Horizontally align cell contents (left, center right).

 <tr valign=?> or <td valign=?>
Vertically align cell contents (top, middle, bottom).

 <td colspan=#>
Sets the quantity of columns within a cell. (by default 1)

 <td rowspan=#>
Sets the quantity of rows within a cell. (by default 1)


(Note: a HTML document may contain a header and a body or a header and a frameset, but not both.)

Delimits the frameset.

 <frameset rows="value,value">
Establish the frames in rows; each value is a width in pixels, or a percentage of the frameset width, or (maximum of once per frameset statement) the value "*" (meaning "the width left over from the other frames").

 <frameset cols="value,value">
Establish the frames in columns; each value is a height in pixels, or a percentage of the frameset height, or (maximum of once per frameset statement) the value "*" (meaning "the height left over from the other frames").

Delimits a single frame - or region - within the frameset.

Indicates what will appear in web browsers that don't support frames.

Frame attributes

 <frame src="URL">
Indicates the URI of the document to be displayed in the frame.

 <frame name="name">
Names the frame or region; so it can be called from another frame (e.g. so that the target of a link in a menu frame can be displayed in the main content frame).

 <frame marginwidth=#>
Equal or greater than 1

 <frame marginheight=#>

 <frame scrolling=VALUE>
Sets if the frame will include a scroll bar; values are "yes", "no", or "auto". By default is "auto". Setting "scrolling=no" can usually better be avoided: scrolling is usually essential in cases where a text does not fit in the available space, which is dependent on browser window size and font setting.

 <frame noresize>
Don't allow the user to change the frame size.


Note: HTML can only specify the form appearance; processing of the user's input must be done with a script.

Delimits a form.

 <select multiple name="NAME" size=?></select>
Creates a scroll menu, from which the user can select multiple options. Size sets the number of visible items before the user needs scrolling.

 <select name="NAME"></select>
Creates a menu list, from which the user can select a single option.

Delimits a menu option in a scroll menu or menu list.

 <input type="checkbox" name="NAME">
Creates a checkbox.

 <input type="radio" name="NAME" value="x">
Creates a radio button[?]; if multiple radio buttons are given the same name, the user will only be able to select one of them.

 <input type=text name="foo" size=# maxlength=#>
Creates a one-line text area. Size sets the long dimension in character-widths. Maxlength sets the maximum number of characters the user can enter (which may be greater than size).

 <textarea name="NAME" cols=# rows=#></textarea>
Create a multiple-line text area. Text in between the tags appears in the text area when the page is loaded.

 <input type="submit" value="NAME">
Creates a send button.

 <input type="image" border=0 name="NAME" src="name.gif">
Creates a send button using a image.

 <input type="reset">
Creates a reset button (that resets the form to its default values).

External links

All Wikipedia text is available under the terms of the GNU Free Documentation License

  Search Encyclopedia

Search over one million articles, find something about almost anything!
  Featured Article
Great River, New York

... are Hispanic or Latino of any race. There are 509 households out of which 41.5% have children under the age of 18 living with them, 70.9% are married couples livin ...

This page was created in 29.9 ms