s -

 <  Day Day Up  >  


<s> - <xmp>

<s> ( Strikethrough )

This element renders the enclosed text with a line drawn through it.

Standard Syntax (Transitional Only)

 <s      class="class name(s)"      dir="ltr  rtl"      id="unique alphanumeric identifier"      lang="language code"      style="style information"      title="advisory text">     </s> 

Attributes Defined by Internet Explorer

 accesskey="key" (5.5)      contenteditable="false  true  inherit" (5.5)      disabled="false  true" (5.5)      hidefocus="true  false" (5.5)      language="javascript  jscript  vbs  vbscript" (4)      tabindex="number" (5.5)      unselectable="off  on" (5.5) 

Standard Event Attributes

 onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove,  onmouseout, onmouseover, onmouseup 

Events Defined by Internet Explorer

 onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate,  onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy,  oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover,   ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onlosecapture,  onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste,  onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart,  onselectstart, ontimeerror 

Examples

 This line contains a  <s>  misstake  </s>  .  <s id="strike1"   onmouseover="this.style.color='red';"   onmouseout="this.style.color='black';">  Fastball  </s>  

Compatibility

HTML 4, 4.01 transitional
XHTML 1.0 transitional

Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 3, 4, 4.5-4.8, 6, 7
Opera 4, 5, 6, 7

Notes

  • This element should act the same as the strike element.

  • This HTML 3 element eventually was adopted by Netscape and Microsoft and later was incorporated into the HTML 4.01 transitional specification.

  • This element has been deprecated by the W3C. The strict HTML 4.01 specification does not include the s element or the strike element. It is possible to indicate strikethrough text using a style sheet.

<samp> (Sample Text)

This element is used to indicate sample text. Enclosed text generally is rendered in a monospaced font.

Standard Syntax

 <samp      class="class name(s)"      dir="ltr  rtl"      id="unique alphanumeric string"      lang="language code"      style="style information"      title="advisory text">     </samp> 

Attributes Defined by Internet Explorer

 accesskey="key" (5.5)      contenteditable="false  true  inherit" (5.5)      disabled="false  true"  (5.5)      hidefocus="true  false" (5.5)      language="javascript  jscript  vbs  vbscript" (4)      tabindex="number" (5.5)      unselectable="off  on" (5.5) 

Standard Event Attributes

 onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove,  onmouseout, onmouseover, onmouseup 

Events Defined by Internet Explorer

 onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate,  onbeforeeditfocus, onbeforepaste, oncontextmenu, oncontrolselect, oncopy, oncut,  ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart,  ondrop, onfocus, onfocusin, onfocusout, onhelp, onlosecapture, onmouseenter,  onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste,  onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart,  onselectstart, ontimeerror 

Example

 Use the following salutation in all e-mail messages to the boss:  <samp>  Please excuse the interruption, oh exalted manager.  </samp>  

Compatibility

HTML 2, 3.2, 4, 4.01
XHTML 1.0, 1.1, Basic

Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1, 2, 3, 4, 4.5-4.8, 6, 7
Opera 4, 6, 7

Notes

  • As a logical element, samp is useful to bind style rules to.

  • The HTML 2.0 and 3.2 specifications support no attributes for this element.

<script> (Scripting)

This element encloses statements in a scripting language for client-side processing. Scripting statements can either be included inline or loaded from an external file and might be commented out to avoid execution by nonscripting-aware browsers.

Standard Syntax

 <script      charset="character set"      defer="defer"      id="unique alphanumeric identifier"      language="scripting language name"      src="url of script code"      type="mime type"      xml:space="preserve">     </script> 

Attributes Defined by Internet Explorer

 event="event name" (3)      for="element ID" (3) 

Events Defined by Internet Explorer

 onload, onpropertychange, onreadystatechange 

Element-Specific Attributes

charset       This attribute defines the character encoding of the script. The value is a space- and/or comma-delimited list of character sets as defined in RFC 2045. The default value is ISO-8859-1 .

defer       Presence of this attribute indicates that the browser might defer execution of the script enclosed by the <script> tag. In practice, deferring code might be more dependent on the position of the <script> tag or the contents. Support for this attribute is inconsistent.

event       This Microsoft-specific attribute is used to define a particular event that the script should react to. It must be used in conjunction with the for attribute. Event names are the same as event handler attributes; for example, onclick , ondblclick , and so on.

for       The for attribute is used in Microsoft browsers to define the name or ID of the element to which an event defined by the event attribute is related . For example, <script event="onclick" for="button1" language="vbscript"> defines a VBScript that will execute when a click event is issued for an element named button1.

language       This attribute specifies the scripting language being used. The Netscape implementation supports JavaScript. The Microsoft implementation supports JScript (a JavaScript clone) as well as VBScript, which can be indicated by either vbs or vbscript . IE does recognize the value of "JavaScript" in the language attribute, regardless of how they name their scripting language. Other values that include the version of the language used, such as JavaScript1.1 and JavaScript1.2 , also might be possible and are useful to exclude browsers from executing script code that is not supported.

src       This attribute specifies the URL of a file containing scripting code. Typically, files containing JavaScript code will have a .js extension, and a server will attach the appropriate MIME type; if not, the type attribute might be used to explicitly set the content type of the external script file. The language attribute also might be helpful in determining this.

type       This attribute should be set to the MIME type corresponding to the scripting language used. For JavaScript, for example, this would be text/javascript . In practice, the language attribute is the more common way to indicate which scripting language is in effect, but the type attribute is standard.

xml:space       This attribute is included from XHTML 1.0 on, and is used to set whether spaces need to be preserved within the script element or whether the default white space handling should be employed. In practice, this attribute is not used by developers.

Examples

  <script type="text/javascript">  alert("Hello World !!!");  </script>  <!-- code in external file -->  <script language="JavaScript1.2" src="superrollover.js"></script>  

Compatibility

HTML 4, 4.01
XHTML 1.0, 1.1

Internet Explorer 3, 4, 5, 5.5, 6
Netscape 2, 3, 4, 4.5-4.8, 6, 7
Opera 4-7

Notes

  • It is common practice to comment out statements enclosed by a <script> tag. Without commenting, scripts are displayed as page content by browsers that do not support scripting. The particular comment style might be dependent on the language being used. For example, in JavaScript, use

      <script type="text/javascript">  <!--  JavaScript code here  // --> <  /script  > 

    In VBScript, use

      <script type="text/vbscript">  <!--  VBScript code here  -->  </script>  
  • The HTML 3.2 specification defined a placeholder script element.

  • The event and for attributes are defined under transitional versions of HTML 4.01 but only as reserved values. Later specifications appear to have dropped potential support for them, though they continue to be supported by Internet Explorer.

  • Most browsers assume JavaScript when parsing a script element without a set type or language attribute.

  • Refer to the <noscript> tag reference in this appendix to see how content might be identified for nonscripting-aware browsers.

<select> (Selection List)

This element defines a selection list within a form. Depending on the form of the selection list, the control allows the user to select one or more list options.

Standard Syntax

 <select      class="class name(s)"      dir="ltr  rtl"      disabled="disabled"      id="unique alphanumeric identifier"      lang="language code"      multiple="multiple"      name="unique alphanumeric name"      size="number"      style="style information"      tabindex="number"      title="advisory text">  option and optgroup elements only  </select> 

Attributes Defined by Internet Explorer

 accesskey="character"  (4)      align="absbottom  absmiddle  baseline  bottom             left  middle  right  texttop  top" (4)      datafld="column name" (4)      datasrc="data source ID" (4)      hidefocus="true  false" (5.5)      language="javascript  jscript  vbs  vbscript" (4)      unselectable="on  off" (5.5) 

Standard Event Attributes

 onblur, onchange, onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown,  onmousemove, onmouseout, onmouseover, onmouseup 

Events Defined by Internet Explorer

 onactivate, onafterupdate, onbeforeactivate, onbeforecut, onbeforedeactivate,  onbeforeeditfocus, onbeforepaste, onbeforeupdate, oncontextmenu, oncontrolselect,  oncut, ondeactivate, ondragenter, ondragleave, ondragover, ondrop, onerrorupdate,  onfocus, onfocusin, onfocusout, onhelp, onlosecapture, onmouseenter, onmouseleave,  onmousewheel, onmove, onmoveend, onmovestart, onpaste, onpropertychange,  onreadystatechange, onresize, onresizeend, onresizestart, onselectstart 

Element-Specific Attributes

align       This Microsoft-specific attribute controls the alignment of the image with respect to the content on the page. The default value is left , but other values such as absbottom , absmiddle , baseline , bottom , middle , right , texttop , and top also might be supported. The meaning of these values should be similar to those used for inserted objects, such as images.

datafld       This Internet Explorer-specific attribute is used to indicate the column name in the data source that is bound to the options in the select element.

datasrc       The value of this Internet Explorer-specific attribute is set to an identifier indicating the data source that data should be pulled from.

disabled       This attribute is used to turn off a form control. Elements will not be submitted nor can they receive any focus from the keyboard or mouse. Disabled form controls will not be part of the tabbing order. The browser also can gray out the form that is disabled in order to indicate to the user that the form control is inactive. This attribute requires no value under traditional HTML, but under XHTML variants should be set to disabled .

multiple       This attribute allows the selection of multiple items in the selection list. The default is single-item selection. Under XHTML, this attribute must have a value set to multiple .

name       This attribute allows a form control to be assigned a name so that it can be referenced
by a scripting language. Name is supported by older browsers, such as Netscape 2-generation browsers, but the W3C encourages the use of the id attribute. For compatibility purposes, both might have to be used, though this may cause trouble. See Chapter 12 for implementation issues concerning name and id collisions.

size       This attribute sets the number of visible items in the selection list. When the multiple attribute is not present, only one entry should show; however, when multiple is present, this attribute is useful for setting the size of the scrolling list box.

tabindex       This attribute takes a numeric value indicating the position of the form control in the tabbing index for the form. Tabbing proceeds from the lowest positive tabindex value to the highest. Negative values for tabindex will leave the form control out of the tabbing order. When tabbing is not explicitly set, the browser might tab through items in the order they are encountered . Form controls that are disabled due to the presence of the disabled attribute will not be part of the tabbing index.

Examples

 Choose your favorite colors:  <select name="colors" multiple="multiple" size="2">   <option>  Red  </option>   <option>  Blue  </option>   <option>  Green  </option>   <option>  Yellow  </option>   </select>  Taco Choices:  <select name="tacomenu">   <option value="SuperChicken">Chicken</option>   <option value="Baja">Fish</option>   <option value="RX-Needed">Carnitas</option>   </select>  

Compatibility

HTML 2, 3.2, 4, 4.01
XHTML 1.0, 1.1, Basic

Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1, 2, 3, 4, 4.5-4.8, 6, 7
Opera 4-7

Notes

  • The HTML 4.01 specification reserves the attributes datafld and datasrc for future use, but these are removed under XHTML.

  • Internet Explorer's variant of the disabled attribute allows values of true and false , as well as the standard disabled value.

  • Under traditional HTML, the end tag </option> is often omitted.

  • Be careful of the name and id attribute problem that may occur, particularly when setting the multiple attribute. It may be better to have separate values.

  • The HTML 2.0 and 3.2 specifications define only multiple , name , and size attributes.

<small> (Small Text)

This element renders the enclosed text one font size smaller than a document's base font size, unless it is already set to the smallest size.

Standard Syntax

 <small      class="class name(s)"      dir="ltr  rtl"      id="unique alphanumeric string"      lang="language code"      style="style information"      title="advisory text"> </small> 

Attributes Defined by Internet Explorer

 accesskey="key" (5.5)      contenteditable="false  true  inherit" (5.5)      hidefocus="true  false" (5.5)      language="javascript  jscript  vbs  vbscript" (4)      tabindex="number" (5.5)      unselectable="on  off" 

Standard Event Attributes

 onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove,  onmouseout, onmouseover, onmouseup 

Events Defined by Internet Explorer

 onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate,  onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy,  oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover,  ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onlosecapture,  onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste,  onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart,  onselectstart, ontimeerror 

Examples

 Here is some  <small>  small text  </small>  . This element can be applied  <small><small><small>  multiple times  </small></small></small>  to make things even smaller. 

Compatibility

HTML 3.2, 4, 4.01
XHTML 1.0, 1.1

Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 2, 3, 4, 4.5-4.8, 6, 7
Opera 4-7

Notes

  • A <small> tag can be used multiple times to decrease the size of text to a greater degree. Using more than six <small> tags together doesn't make sense because browsers currently only support relative font sizes from 1 to 7 . As style sheets become more common, this element might fall out of favor or be used with measurements in a more logical fashion.

  • The default base font size for a document typically is 3 , although it can be changed with the <basefont> tag.

<spacer> (Extra Space)

This Netscape proprietary element specifies an invisible region that is useful for page layout.

Proprietary Syntax (Netscape 3 and 4 Only)

 <spacer      align="absmiddle  absbottom  baseline  bottom               left  middle  right  texttop  top"      height="pixels"      size="pixels"      type="block  horizontal  vertical"      width="pixels"> 

Element-Specific Attributes

align       This attribute specifies the alignment of the spacer with respect to surrounding text. It is used only with spacers with type="block" . The default value for the align attribute is bottom . The meanings of the align values are similar to those used with the img element.

height       This attribute specifies the height of the invisible region in pixels. It is used only with spacers with type="block" .

size       Used with type="block" and type="horizontal" spacers, this attribute sets the spacer's width in pixels. Used with a type="vertical" spacer, this attribute is used to set the spacer's height.

type       This attribute indicates the type of invisible region. A horizontal spacer adds horizontal space between words and objects. A vertical spacer is used to add space between lines. A block spacer defines a general-purpose positioning rectangle, like an invisible image that text can flow around.

width       This attribute is used only with the type="block" spacer and is used to set the width of the region in pixels.

Examples

 A line of text with two <spacer type="horizontal" size="20">words  separated by 20 pixels. Here is a line of text  .<br>   <spacer type="vertical" size="50">  Here is another line of text with a large space between the two  lines.  <spacer align="left" type="block" height="100" width="100">  This  is a bunch of text that flows around an invisible block region. You could have easily performed this layout with a table. 

Compatibility

No standards

Netscape 3, 4, 4.5-4.8

Notes

  • This element should not be used. Newer versions of the Netscape browser (6 and 7) have dropped support for this element.

  • Some Web editors and slicing tools, particularly older versions of Adobe GoLive (formerly known as CyberStudio), rely on this element. It should be removed from documents, and spacer GIFs or other techniques should be used.

<span> (Text Span)

This element typically is used to group inline text so scripting or style rules can be applied to
the content. As it has no preset or rendering meaning, this is the most useful inline element for associating style and script with content.

Syntax

 <span      class="class name(s)"      dir="ltr  rtl"      id="unique alphanumeric string"      lang="language code"      style="style information"      title="advisory text">     </span> 

Attributes Defined by Internet Explorer

 accesskey="key" (5.5)      contenteditable="false  true  inherit" (5.5)      datafld="column name" (4)      dataformatas="html  text" (4)      datasrc="data source id" (4)      hidefocus="true  false" (5.5)      language="javascript  jscript  vbs  vbscript" (4)      tabindex="number" (5.5)      unselectable="on  off" (5.5) 

Standard Event Attributes

 onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove,  onmouseout, onmouseover, onmouseup 

Events Defined by Internet Explorer

 onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate,  onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy,  oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover,  ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onlosecapture,  onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste,  onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart,  onselectstart, ontimeerror 

Examples

 Here is some <span style="font-size: 14pt; color: purple;">very  strange  </span>  text.  <span id="toggletext"   onclick="this.style.color='red';"   ondblclick="this.style.color='black';">  Click and Double Click Me  </span>  

Compatibility

HTML 4, 4.01
XHTML 1.0, 1.1, Basic

Internet Explorer 3, 4, 5, 5.5, 6
Netscape 4, 4.5-4.8, 4.7, 6, 7
Opera 4, 5, 6, 7

Notes

  • Chapter : The HTML 4.01 specification reserved the datafld , dataformatas , and datasrc attributes for future use. They were later dropped from XHTML. Internet Explorer 4 and later support these attributes for data binding, as discussed in Chapter 7.

  • As a generic element, span , like div , is useful for binding style to arbitrary content. However, span is an inline element and does not cause a return by default like div .

<strike> (Strikeout Text)

This element is used to indicate strikethrough text, namely text with a line drawn through it. The s element provides shorthand notation for this element.

Syntax (Transitional Only)

 <strike      class="class name(s)"      dir="ltr  rtl"      id="unique alphanumeric string"      lang="language code"      style="style information"      title="advisory text">     </strike> 

Attributes Defined by Internet Explorer

 accesskey="key" (5.5)      contenteditable="false  true  inherit" (5.5)      disabled="false  true" (5.5)      hidefocus="true  false" (5.5)      language="javascript  jscript  vbs  vbscript" (4)      tabindex="number" (5.5)      unselectable="on  off" (5.5) 

Standard Event Attributes

 onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove,  onmouseout, onmouseover, onmouseup 

Events Defined by Internet Explorer

 onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate,  onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy,  oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover,  ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onlosecapture,  onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste,  onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart,  onselectstart, ontimeerror 

Examples

 This line contains a spelling  <strike>  misstake  </strike>  mistake. Price: $  <strike style="color: red;">  5.00  </strike>  3.00 

Compatibility

HTML 3.2, 4, 4.01 (transitional)
XHTML 1.0 (transitional)

Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 3, 4, 4.5-4.8, 6, 7
Opera 4-7

Notes

  • This tag should act the same as the <s> tag.

  • This element has been deprecated by the W3C. The strict HTML and XHTML specifications do not include the <strike> tag nor the <s> tag as it is possible to indicate strikethrough text using the style sheet property text-decoration .

<strong> (Strong Emphasis)

This element indicates strongly emphasized text. It usually is rendered in a bold typeface, but its rendering is not guaranteed , as it is a logical element.

Syntax

 <strong      class="class name(s)"      dir="ltr  rtl"      id="unique alphanumeric string"      lang="language code"      style="style information"      title="advisory text">     </strong> 

Attributes Defined by Internet Explorer

 accesskey="key" (5.5)      contenteditable="false  true  inherit" (5.5)      disabled="false  true" (5.5)      hidefocus="true  false" (5.5)      language="javascript  jscript  vbs  vbscript" (4)      tabindex="number" (5.5)      unselectable="on  off" (5.5) 

Standard Event Attributes

 onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove,  onmouseout, onmouseover, onmouseup 

Events Defined by Internet Explorer

 onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate,  onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy,  oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover,  ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onlosecapture,  onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste,  onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart,  onselectstart, ontimeerror 

Examples

 It is really  <strong>  important  </strong>  to pay attention.  <strong style="font-family: impact; font-size: 28pt">  Important Info  </strong>  

Compatibility

HTML 2, 3.2, 4, 4.01
XHTML 1.0, 1.1, Basic

Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1, 2, 3, 4, 4.5-4.8, 6, 7
Opera 4-7

Notes

  • This element generally renders as bold text. As a logical element, however, strong is useful to bind style rules to.

  • As compared to b , this element does have meaning. For example, voice browsers may speak <strong> enclosed text in a different voice than text that is enclosed by <b> .

<style> (Style Information)

This element is used to surround style sheet rules for a document. This element should be found only in the head element. Style rules within a document's <body> should be set with the style attribute for a particular element.

Syntax

 <style      dir="ltr  rtl"      id="unique alphanumeric string"      lang="language code"      media="all  print  screen  others  "      title="advisory text"      type="MIME Type"      xml:space="preserve">  CSS properties  </style> 

Common Attributes

 disabled="disabled" (DOM Level 1) 

Events Introduced by Internet Explorer

 onerror, onreadystatechange 

Element-Specific Attributes

disabled       This initially Microsoft-defined attribute is used to disable a style sheet. The presence of the attribute is all that is required to disable the style sheet. In conjunction with scripting, this attribute could be used to turn on and off various style sheets in a document. While not documented in later versions of Internet Explorer, this attribute is very much supported and used, since it is part of the DOM standard. Internet Explorer may also support values of true and false .

media       This attribute specifies the destination medium for the style information. The value of the attribute can be a single media descriptor, like screen or a comma-separated list. Possible values for this attribute include all , aural , braille , print , projection , screen , and tv . Other values also might be defined, depending on the browser. Internet Explorer supports all , print , and screen as values for this attribute.

type       This attribute is used to define the type of style sheet. The value of the attribute should be the MIME type of the style sheet language used. The most common current value for this attribute is text/css , which indicates a cascading style sheet format.

xml:space       This attribute is included from XHTML 1.0 and is used to specify whether spaces need to be preserved within the script element or whether the default white space handling should be employed. In practice, this attribute is not used by developers.

Example

  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   <html xmlns="http://www.w3.org/1999/xhtml">   <head>   <title>  Style Sheet Example  </title>   <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />   <style type="text/css">  body {background: black; color: white;           font: 12pt Helvetica;}    h1 {color: red; font: 14pt Impact;}  </style>   </head>   <body>   <h1>  A 14-point red Impact heading on a black  background  </h1>   <p>  Regular body text, which is 12 point white Helvetica.  </p>   </body>   </html>  

Compatibility

HTML 4, 4.01
XHTML 1.0, 1.1

Internet Explorer 3, 4, 5, 5.5, 6
Netscape 4, 4.5-4.8, 6, 7
Opera 4-7

Notes

  • Style information also can be specified in external style sheets as defined by the <link> tag.

  • Style information can also be associated with a particular element using the style attribute.

  • Style rules are often commented out within a <style> tag to avoid interpretation by nonconforming browsers. See Chapter 10 for more details on this practice.

      <style type="text/css">  <!--    body {background-color: red; -->  </style>  

<sub> (Subscript)

This element renders its content as subscripted text.

Syntax

 <sub      class="class name(s)"      dir="ltr  rtl"      id="unique alphanumeric string"      lang="language code"      style="style information"      title="advisory text">     </sub> 

Attributes Defined by Internet Explorer

 accesskey="key" (5.5)      contenteditable="false  true  inherit" (5.5)      disabled="false  true" (5.5)      hidefocus="true  false" (5.5)      language="javascript  jscript  vbs  vbscript" (4)      tabindex="number" (5.5)      unselectable="on  off" (5.5) 

Standard Event Attributes

 onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove,  onmouseout, onmouseover, onmouseup 

Events Defined by Internet Explorer

 onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate,  onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy,  oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover,  ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onlosecapture,  onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste,  onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart,  onselectstart, ontimeerror 

Examples

 Here is some  <sub>  subscripted  </sub>  text. The secret formula is X  <sub><small>  2  </small></sub>  

Compatibility

HTML 3.2, 4, 4.01
XHTML 1.0

Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 2, 3, 4, 4.5-4.8, 6, 7
Opera 4-7

Notes

  • The HTML 3.2 specification supports no attribute for <sub> .

  • The <sub> tag is removed from XHTML 1.1 since it can be created using the CSS property vertical-align .

  • Most browsers may slightly shift text lines below a <sub> tag.

<sup> (Superscript)

This element renders its content as superscripted text.

Syntax

 <sup      class="class name(s)"      dir="ltr  rtl"      id="unique alphanumeric string"      lang="language code"      style="style information"      title="advisory text">     </sup> 

Attributes Defined by Internet Explorer

 accesskey="key" (5.5)      contenteditable="false  true  inherit" (5.5)      hidefocus="true  false" (5.5)      language="javascript  jscript  vbs  vbscript" (4)      tabindex="number" (5.5)      unselectable="on  off" (5.5) 

Standard Event Attributes

 onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove,  onmouseout, onmouseover, onmouseup 

Events Defined by Internet Explorer

 onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate,  onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy,  oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover,  ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onlosecapture,  onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste,  onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart,  onselectstart, ontimeerror 

Examples

 Here is some  <sup>  superscripted  </sup>  text. x  <sup>  2  </sup>  = 4 when x = 2 

Compatibility

HTML 3.2, 4, 4.01
XHTML 1.0

Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 2, 3, 4, 4.5-4.8, 6, 7
Opera 4-7

Notes

  • The HTML 3.2 specification supports no attribute for <sup> .

  • The <sup> tag is removed from XHTML 1.1 since it can be created using the CSS property vertical-align .

  • Most browsers may slightly shift text lines above a <sup> tag.

<table> (Table)

This element is used to define a table. Tables are used to organize data as well as to provide structure for laying out pages when not using CSS.

Standard Syntax

 <table      align="center  left  right" (transitional only)      bgcolor="color name  #RRGGBB" (transitional only)      border="pixels"      cellpadding="pixels"      cellspacing="pixels"      class="class name(s)"      dir="ltr  rtl"      frame="above  below  border  box  hsides              lhs  rhs  void  vsides"      id="unique alphanumeric identifier"      lang="language code"      rules="all  cols  groups  none  rows"      style="style information"      summary="summary information"      title="advisory text"      width="percentage  pixels">  caption, col, colgroup, thead, tbody, tfoot, and tr elements only  </table> 

Nonstandard Attributes Commonly Supported

 background="url of image" file      bordercolor="color name  #RRGGBB"      cols="number of columns"      height="percentage  pixels"      hspace="pixels" (Netscape variants only)      vspace="pixels" (Netscape variants only) 

Attributes Defined by Internet Explorer

 accesskey="key" (5.5)      bordercolordark="color name  #RRGGBB" (4)      bordercolorlight="color name  #RRGGBB" (4)      datapagesize="number of records to display" (4)      datasrc="data source id" (4)      hidefocus="true  false" (5.5)      language="javascript  jscript  vbs  vbscript" (4)      tabindex="number" (5.5)      unselectable="on  off" (5.5) 

Standard Event Attributes

 onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove,  onmouseout, onmouseover, onmouseup 

Events Defined by Internet Explorer

 onactivate, onbeforeactivate, onbeforecut, onbeforedeactivate, onbeforeeditfocus,  onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy, oncut, ondeactivate,  ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop,  onfilterchange, onfocus, onfocusin, onfocusout, onhelp, onlosecapture,  onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste,  onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart,  onscroll, onselectstart, ontimeerror 

Element-Specific Attributes

align       This attribute specifies the alignment of the table with respect to surrounding text.
The HTML 4.01 specification defines center , left , and right . Some browsers also might support alignment values, such as absmiddle , that are common to block objects.

background       This nonstandard attribute, which is supported by nearly every browser, specifies the URL of a background image for the table. The image is tiled if it is smaller than the table dimensions. Note that some early versions of Netscape display the background image in each table cell , rather than behind the complete table, as in Internet Explorer.

bgcolor       This attribute specifies a background color for a table. Its value can be either a named color, such as red , or a color specified in the hexadecimal #RRGGBB format, such as #FF0000 .

border       This attribute specifies, in pixels, the width of a table's borders. A value of makes a borderless table, which is useful for graphic layout.

bordercolor       This attribute, supported by Internet Explorer and Netscape, is used to set the border color for a table. The attribute should be used only with a positive value for the border attribute. The value of the attribute can be either a named color, such as green , or a color specified in the hexadecimal #RRGGBB format, such as #00FF00 . The color applications may be slightly different in the two browsers, since Netscape colors only the outer border of the table.

bordercolordark       This Internet Explorer-specific attribute specifies the darker of two border colors used to create a three-dimensional effect for cell borders. It must be used with the border attribute set to a positive value. The attribute value can be either a named color, such as blue , or a color specified in the hexadecimal #RRGGBB format, such as #00FF00 .

bordercolorlight       This Internet Explorer-specific attribute specifies the lighter of two border colors used to create a three-dimensional effect for cell borders. It must be used with the border attribute set to a positive value. The attribute value can be either a named color, such as red , or a color specified in the hexadecimal #RRGGBB format, such as #FF0000 .

cellpadding       This attribute sets the width, in pixels, between the edge of a cell and its content.

cellspacing       This attribute sets the width, in pixels, between individual cells .

cols       This attribute specifies the number of columns in the table and is used to help quickly calculate the size of the table. This attribute was part of the preliminary specification of HTML 4.0, but was later dropped. A few browsers, notably Netscape and Internet Explorer, support it.

datapagesize       The value of this Microsoft-specific attribute is the number of records that can be displayed in the table when data binding is used.

datasrc       The value of this Microsoft-specific attribute is an identifier indicating the data source that data will be pulled from for data binding. See Chapter 7 for an example.

frame       This attribute specifies which edges of a table are to display a border frame. A value of above indicates only the top edge; below indicates only the bottom edge; and border and box indicate all edges, which is the default when the border attribute is a positive integer. A value of hsides indicates only the top and bottom edges should be displayed, lhs indicates the left-hand edge should be displayed, rhs indicates the right-hand edge should be displayed, vsides indicates the left and right edges both should be displayed, and void indicates no border should be displayed.

height       This attribute specifies the height of the table in pixels or percentage of the browser window. Be careful, because some browser versions may not support percentage values on height or may have variations in this calculation when they do support it.

hspace       This Netscape-specific attribute indicates the horizontal space, in pixels, between the table and surrounding content, similar to the same attribute on <img> .

rules       This attribute controls the display of dividing rules within a table. A value of all specifies dividing rules for rows and columns. A value of cols specifies dividing rules for columns only. A value of groups specifies horizontal dividing rules between groups of table cells defined by the thead , tbody , tfoot , or colgroup elements. A value of rows specifies dividing rules for rows only. A value of none indicates no dividing rules and is the default.

summary       This attribute is used to provide a text summary of the table's purpose and structure. This element is used for accessibility, and its presence is important for non-visual user agents .

vspace       This Netscape attribute indicates the vertical space in pixels between the table and surrounding content, similar to the same attribute on <img> .

width       This attribute specifies the width of the table either in pixels or as a percentage of the enclosing window.

Examples

 <table bgcolor="white" border="2">    <tr>       <td>Cell 1</td>       <td>Cell 2</td>       <td>Cell 3</td>       <td>Cell 4</td>    </tr>        <tr>       <td>Cell 5</td>       <td>Cell 6</td>    </tr> </table> <table rules="all" bgcolor="yellow"> <caption>Widgets by Area</caption> <thead align="center" bgcolor="green" valign="middle">    <tr>    <td>This is a Header</td>    </tr> </thead>     <tfoot align="right" bgcolor="red" valign="bottom">    <tr>    <td colspan="2">This is part of the footer.</td>    <td>This is also part of the footer.</td>    </tr> </tfoot>     <tbody>    <tr>       <td>&nbsp;</td>       <th>Regular Widget</th>       <th>Super Widget</th>    </tr>        <tr>       <th>West Coast</th>       <td>10</td>       <td>12</td>    </tr>        <tr>       <th>East Coast</th>       <td>1</td>       <td>20</td>    </tr> </tbody> </table> 

Compatibility

HTML 3.2, 4, 4.01
XHTML 1.0, 1.1, Basic

Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1.1, 2, 3, 4, 4.5-4.8, 6, 7
Opera 4-7

Notes

  • In addition to displaying tabular data, tables are used to support graphic layout and design.

  • The HTML 4 specification reserved the attributes datasrc , datafld , dataformatas , and datapagesize for future versions. However, XHTML dropped these attributes. They are supported in Internet Explorer 4 and later.

  • At the time of this writing, most browsers have problems with char and charoff attributes in all table-related tags.

  • The HTML 3.2 specification defines only the align , border , cellpadding , cellspacing , and width attributes for the table element.

  • The cols attribute might provide an undesirable result under some versions of Netscape, which assumes the size of each column in the table is exactly the same.

<tbody> (Table Body)

This element is used to group the rows within the body of a table so that common alignment and style defaults can easily be set for numerous cells.

Standard Syntax

 <tbody  align="center  char  justify  left  right"         char="character"         charoff="offset"         class="class name(s)"         dir="ltr  rtl"         id="unique alphanumeric identifier"         lang="language code"         style="style information"         title="advisory text"         valign="baseline  bottom  middle  top">  tr elements only  </tbody> 

Attributes Defined by Internet Explorer

 accesskey="key" (5.5)      bgcolor="color name  #RRGGBB" (4)      hidefocus="true  false" (5.5)      language="javascript  jscript  vbs  vbscript" (4)      tabindex="number" (5.5)      unselectable="on  off" (5.5) 

Standard Event Attributes

 onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove,  onmouseout, onmouseover, onmouseup 

Events Defined by Internet Explorer

 onactivate, onbeforeactivate, onbeforecut, onbeforedeactivate, onbeforepaste,  onblur, oncontextmenu, oncontrolselect, oncopy, oncut, ondeactivate, ondrag,  ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onfocus,  onfocusin, onfocusout, onhelp, onlosecapture, onmouseenter, onmouseleave,  onmousewheel, onmove, onmoveend, onmovestart, onpaste, onpropertychange,  onreadystatechange, onresize, onresizeend, onresizestart, onselectstart,  ontimeerror 

Element-Specific Attributes

align       This attribute is used to align the contents of the cells within a <tbody> tag. Common values are center , justify , left , and right . The specification also defines a value of char . When align is set to char , the attribute char must be present and set to the character to which cells should be aligned. A common use of this approach would be to set cells to align on a decimal point. Unfortunately, browsers do not support the char align value well.

bgcolor       This attribute specifies a background color for the cells within a <tbody> tag. Its value can be either a named color, such as red , or a color specified in the hexadecimal #RRGGBB format, such as #FF0000 .

char       This attribute is used to define the character to which element contents are aligned when the align attribute is set to the char value.

charoff       This attribute contains an offset as a positive or negative integer to align characters as related to the char value. A value of 2 would align characters in a cell two characters to the right of the character defined by the char attribute.

valign       This attribute is used to set the vertical alignment for the table cells within a <tbody> tag. The HTML specification defines baseline , bottom , middle , and top . Internet Explorer also supports center , which should act like middle .

Example

  <table rule="all" bgcolor="yellow">   <tbody align="center" bgcolor="red" style="bodystyle"   valign="baseline">   <tr>   <td>&nbsp;</td>   <th>  Regular Widget  </th>   <th>  Super Widget  </th>   </tr>   <tr>   <th>  West Coast  </th>   <td>  10  </td>   <td>  12  </td>   </tr>   <tr>   <th>  East Coast  </th>   <td>  1  </td>   <td>  20  </td>   </tr>   </tbody>   </table>  

Compatibility

HTML 4, 4.01
XHTML 1.0, 1.1

Internet Explorer 4, 5, 5.5, 6
Netscape 6, 7
Opera 5-7

Notes

  • This element is found only in a <table> tag and contains one or more table rows, as indicated by <tr> tags.

  • For XHTML compatibility, the closing </tbody> tag must be used with this element; however, it is optional under traditional HTML.

<td> (Table Data)

This element specifies a data cell in a table. The element should occur within a table row as defined by the tr element.

Standard Syntax

 <td      abbr="abbreviation"      align="center  justify  left  right"      axis="group name"      bgcolor="color name  #RRGGBB" (transitional only)      char="character"      charoff="offset"      class="class name"      colspan="number of columns to span"      dir="ltr  rtl"      headers="space-separated list of associated header               cells' id values"      height="pixels or percentage" (transitional only)      id="unique alphanumeric identifier"      lang="language code"      nowrap="nowrap" (transitional only)      rowspan="number or rows to span"      scope="col  colgroup  row  rowgroup"      style="style information"      title="advisory text"      valign="baseline  bottom  middle  top"      width="pixels or percentage">  (transitional only)     </td> 

Nonstandard Attributes Commonly Supported

 background="url of image file"      bordercolor="color name  #RRGGBB" 

Attributes Defined by Internet Explorer

 accesskey="key" (5.5)      background="url of image file" (4)      bordercolor="color name  #RRGGBB" (4)      bordercolordark="color name  #RRGGBB" (4)      bordercolorlight="color name  #RRGGBB" (4)      hidefocus="true  false" (5.5)      language="javascript  jscript  vbs  vbscript" (4)      tabindex="number" (5.5)      unselectable="on  off" (5.5) 

Standard Event Attributes

 onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove,  onmouseout, onmouseover, onmouseup 

Events Defined by Internet Explorer

 onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate,  onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy,  oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover,  ondragstart, ondrop, onfilterchange, onfocus, onfocusin, onfocusout, onhelp,  onlosecapture, onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend,  onmovestart, onpaste, onpropertychange, onreadystatechange, onresizeend,  onresizestart, onselectstart, ontimeerror 

Element-Specific Attributes

abbr       The value of this attribute is an abbreviated name for a header cell. This might be useful when attempting to display large tables on small screens.

align       This attribute is used to align the contents of the cells. Supported values are center , justify , left , and right .

axis       This attribute is used to provide a name for a group of related headers.

background       This nonstandard attribute, which is supported by major browsers, specifies the URL of a background image for the table cell. The image is tiled if it is smaller than the cell's dimensions.

bgcolor       This attribute specifies a background color for a table cell. Its value can be either a named color, such as red , or a color specified in the hexadecimal #RRGGBB format, such as #FF0000 . Note that some older versions of Netscape Navigator may not render a cell with a colored background unless a nonbreaking space, at least, is inserted in the cell.

bordercolor       This attribute, supported by Internet Explorer and Netscape, is used to set the border color for a table cell. The attribute should be used only with a positive value for the border attribute. The value of the attribute can be either a named color, such as green , or a color specified in the hexadecimal #RRGGBB format, such as #00FF00 .

bordercolordark       This Internet Explorer-specific attribute specifies the darker of two border colors used to create a three-dimensional effect for a cell's borders. It must be used with the border attribute set to a positive value. The attribute value can be either a named color, such as blue , or a color specified in the hexadecimal #RRGGBB format, such as #00FF00 .

bordercolorlight       This Internet Explorer-specific attribute specifies the lighter of two border colors used to create a three-dimensional effect for a cell's borders. It must be used with the border attribute set to a positive value. The attribute value can be either a named color, such
as red , or a color specified in the hexadecimal #RRGGBB format, such as #FF0000 .

char       This attribute is used to define the character to which element contents are aligned when the align attribute is set to the char value.

charoff       This attribute contains an offset, specified as a positive or negative integer, to align characters as related to the char value. A value of 2 , for example, would align characters in a cell two characters to the right of the character defined by the char attribute.

colspan       This attribute takes a numeric value that indicates how many columns wide a cell should be. This is useful for creating tables with cells of different widths.

headers       This attribute takes a space-separated list of id values that correspond to the header cells related to this cell.

height       This attribute indicates the height of the cell in pixels or percentage. Some browsers may have rendering problems with percentage values.

nowrap       This attribute keeps the content within a table cell from automatically wrapping. The nowrap attribute takes no value under HTML but should be set to the value nowrap under XHTML.

rowspan       This attribute takes a numeric value that indicates how many rows high a table cell should span. This attribute is useful in defining tables with cells of different heights.

scope       This attribute specifies the table cells that the current cell provides header information for. A value of col indicates that the cell is a header for the rest of the column below it. A value of colgroup indicates that the cell is a header for its current column group. A value of row indicates that the cell contains header information for the rest of the row it is in. A value of rowgroup indicates that the cell is a header for its row group. This attribute might be used in place of the header attribute and is useful for rendering assistance by nonvisual browsers. This attribute was added very late to the HTML 4 specification, and support for this attribute is still minimal.

valign       This attribute is used to set the vertical alignment for the table cell. The specification defines baseline , bottom , middle , and top . Internet Explorer also supports center , which should be the same as middle .

width       This attribute specifies the width of a cell in pixels or percentage value.

Examples

  <table>   <tr>   <td align="left" valign="top" width="100">  Put me in the top left corner.  </td>   <td align="right" bgcolor="red" valign="bottom" width="100">  Put me in the bottom right corner.  </td>   </tr>   </table>   <table border="1" width="80%">   <tr>   <td colspan="3">  A pretty wide cell  </td>   <tr>   <td>  Item 2  </td>   <td>  Item 3  </td>   <td>I  tem 4  </td>   </tr>   </table>  

Compatibility

HTML 3.2, 4, 4.01
XHTML 1.0, 1.1, Basic

Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1.1, 2, 3, 4, 4.5-4.8, 6, 7
Opera 4-7

Notes

  • Under the XHTML 1.0 specification, the closing </td> tag ceases to be optional.

  • The HTML 3.2 specification defines only align , colspan , height , nowrap , rowspan , valign , and width attributes.

  • This element should always be within the tr element.

<textarea> (Multiline Text Input)

This element specifies a multiline text input field contained within a form.

Standard Syntax

 <textarea      accesskey="character"      class="class name"      cols="number"      dir="ltr  rtl"      disabled="disabled"      id="unique alphanumeric identifier"      lang="language code"      name="unique alphanumeric identifier"      readonly="readonly"      rows="number"      style="style information"      tabindex="number"      title="advisory text">     </textarea> 

Attributes Defined by Internet Explorer

 contenteditable="false  true  inherit" (5.5)      datafld="column name" (4)      datasrc="data source ID" (4)      hidefocus="true  false" (5.5)      language="javascript  jscript  vbs  vbscript" (4)      wrap="off  physical  virtual" (4) 

Attributes Defined by Netscape 4

 wrap="hard  off  soft" 

Standard Event Attributes

 onblur, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup,  onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselect 

Events Defined by Internet Explorer

 onactivate, onafterupdate, onbeforeactivate, onbeforecopy, onbeforecut,  onbeforedeactivate, onbeforeeditfocus, onbeforepaste, oncontextmenu,  oncontrolselect, oncopy, oncut, ondeactivate, ondrag, ondragend, ondragenter,  ondragleave, ondragover, ondragstart, ondrop, onerrorupdate, onfilterchange,  onfocus, onfocusin, onfocusout, onhelp, onlosecapture, onmouseenter, onmouseleave,  onmousewheel, onmove, onmoveend, onmovestart, onpaste, onpropertychange,  onreadystatechange, onresize, onresizeend, onresizestart, onselectstart,  ontimeerror 

Element-Specific Attributes

accesskey       This attribute specifies a keyboard navigation accelerator for the element. Pressing ALT or a similar key in association with the specified character selects the form control correlated with that key sequence. Page designers are forewarned to avoid key sequences already bound to browsers.

cols       This attribute sets the width in characters of the text area. The typical default value for the size of a <textarea> tag when this attribute is not set is 20 characters.

datafld       This attribute is used to indicate the column name in the data source that is bound to the content enclosed by the <textarea> tag.

datasrc       The value of this attribute is an identifier indicating the data source to pull data from.

disabled       This attribute is used to turn off a form control. Elements will not be submitted, nor can they receive any focus from the keyboard or mouse. Disabled form controls will not be part of the tabbing order. The browser also can gray out the form that is disabled in order to indicate to the user that the form control is inactive. This attribute requires no value.

name       This attribute allows a form control to be assigned a name so that it can be referenced by a scripting language. Name is supported by older browsers, such as Netscape 2-generation browsers, but the W3C encourages the use of the id attribute. For compatibility purposes, both attributes might have to be used.

readonly       This attribute prevents the form control's value from being changed. Form controls with this attribute set might receive focus from the user but might not be modified. Because they receive focus, a readonly form control will be part of the form's tabbing order. Finally, the control's value will be sent on form submission. Under XHTML, the value of the readonly attribute should be set to readonly .

rows       This attribute sets the number of rows in the text area. The value of the attribute should be a positive integer.

tabindex       This attribute takes a numeric value indicating the position of the form control in the tabbing index for the form. Tabbing proceeds from the lowest positive tabindex value to the highest. Negative values for tabindex will leave the form control out of the tabbing order. When tabbing is not explicitly set, the browser can tab through items in the order they are encountered. Form controls that are disabled due to the presence of the disabled attribute will not be part of the tabbing index, although read-only controls will be.

wrap       In some versions of Netscape and Microsoft browsers, this attribute controls word-wrap behavior. A value of off for the attribute forces the <textarea> not to wrap text, so the viewer must manually enter line breaks. A value of hard causes word wrap and includes line breaks in text submitted to the server. A value of soft causes word wrap but removes line breaks from text submitted to the server. Internet Explorer supports a value of physical , which is equivalent to Netscape's hard value, and a value of virtual , which is equivalent to Netscape's soft value. If the wrap attribute is not included, text will still wrap under Internet Explorer, but older versions of Netscape, notably Netscape 4, will scroll horizontally in the text box. Given this problem, even though it is nonstandard, it may be a good idea to include the wrap attribute.

Examples

  <textarea name="CommentBox" id="CommentBox" cols="40" rows="8">  Default text in field </textarea>  <textarea name="comment" id="comment" rows="10" cols="40" wrap="virtual"   align="center">   </textarea>  

Compatibility

HTML 2, 3.2, 4, 4.01
XHTML 1.0, 1.1

Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1, 2, 3, 4, 4.5-4.8, 6, 7
Opera 4-7

Notes

  • Any text between the <textarea> and </textarea> tags is rendered as the default entry for the form control. Content within a textarea is not interpreted, so white space is preserved and tags themselves are ignored.

  • The HTML 2.0 and 3.2 specifications define only the cols , name , and rows attributes for this element.

  • The textarea element lacks a maxlength attribute, which causes a potential security risk. Potential intruders to a site may copy and paste large amounts of text or script code into a textarea element in an attempt to break a Web application. All submissions from a textarea should be checked carefully to avoid security risks.

  • The HTML 4.01 specification reserves the datafld and datasrc attributes for future use with the textarea element.

<tfoot> (Table Footer)

This element is used to group the rows within the footer of a table so that common alignment and style defaults can easily be set for numerous cells. This element might be particularly useful when setting a common footer for tables that are dynamically generated.

Standard Syntax

 <tfoot      align="center  char  justify  left  right"      char="character"      charoff="offset"      class="class name(s)"      dir="ltr  rtl"      id="unique alphanumeric identifier"      lang="language code"      style="style information"      title="advisory text"      valign="baseline  bottom  middle  top">  tr elements only  </tfoot> 

Attributes Defined by Internet Explorer

 accesskey="key" (5.5)      hidefocus="true  false" (5.5)      language="javascript  jscript  vbs  vbscript" (4)      tabindex="number" (5.5)      unselectable="off  on" (5.5)      valign="center" (4) 

Standard Event Attributes

 onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove,  onmouseout, onmouseover, onmouseup 

Events Defined by Internet Explorer

 onactivate, onbeforeactivate, onbeforecut, onbeforedeactivate, onbeforepaste,  onblur, oncontextmenu, oncontrolselect, oncopy, oncut, ondeactivate, ondrag,  ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onfocus,  onfocusin, onfocusout, onhelp, onlosecapture, onmouseenter, onmouseleave,  onmousewheel, onmove, onmoveend, onmovestart, onpaste, onpropertychange,  onreadystatechange, onresize, onresizeend, onresizestart, onselectstart,  ontimeerror 

Element-Specific Attributes

align       This attribute is used to align the contents of the cells within a <tfoot> tag. Common values are center , justify , left , and right . The HTML and XHTML specifications also define
a value of char . When align is set to char , the attribute char must be present and set to the character to which cells should be aligned. A common use of this approach would be to set
cells to align on a decimal point.

char       This attribute is used to define the character to which element contents are aligned when the align attribute is set to the char value.

charoff       This attribute contains an offset, as a positive or negative integer, for aligning characters as related to the char value. A value of 2 , for example, would align characters in a cell two characters to the right of the character defined by the char attribute.

valign       This attribute is used to set the vertical alignment for the table cells within a <tfoot> tag. The specification defines baseline , bottom , middle , and top . Internet Explorer also supports center , which should be the same as middle .

Example

  <table border="1" bgcolor="yellow" width="80%">   <tfoot align="center" bgcolor="red" class="footer"   valign="bottom">   <tr>   <td>  This is part of the footer.  </td>   <td>  This is also part of the footer.  </td>   </tr>   </tfoot>   <tbody class="tablebody">   <tr>   <td>  The contents of the table!  </td>   </tr>   </tbody>   </table>  

Compatibility

HTML 4, 4.01
XHTML 1.0, 1.1

Internet Explorer 4, 5, 5.5, 6
Netscape 6, 7
Opera 5-7

Notes

  • This element is contained only by the table element and contains table rows as delimited by tr elements.

  • While it would seem that this element should come after a <tbody> tag, it actually should come before it within a <table> tag.

  • Under the XHTML 1.0 specification, the closing </tfoot> tag ceases to be optional.

<th> (Table Header)

This element specifies a header cell in a table. The element should occur within a table row as defined by a tr element. The main difference between this element and td is that browsers might render table headers slightly differently, usually bolding and centering contents. However, the element is logical in nature and should be used to structure tables.

Standard Syntax

 <th      abbr="abbreviation"      align="center  justify  left  right"      axis="group name"      bgcolor="color name  #RRGGBB" (transitional only)      char="character"      charoff="offset"      class="class name"      colspan="number"      dir="ltr  rtl"      headers="space-separated list of associated header               cells' id values"      height="pixels" (transitional only)      id="unique alphanumeric identifier"      lang="language code"      nowrap="nowrap" (transitional only)      rowspan="number"      scope="col  colgroup  row  rowgroup"      style="style information"      title="advisory text"      valign="baseline  bottom  middle  top"      width="pixels">  (transitional only)     </th> 

Nonstandard Attributes Commonly Supported

 background="url of image file"      bordercolor="color name  #RRGGBB" 

Attributes Defined by Internet Explorer

 accesskey="key" (5.5)      bordercolordark="color name  #RRGGBB" (4)      bordercolorlight="color name  #RRGGBB" (4)      hidefocus="true  false" (5.5)      language="javascript  jscript  vbs  vbscript" (4)      tabindex="number" (5.5)      valign="center" (4) 

Standard Event Attributes

 onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove,  onmouseout, onmouseover, onmouseup 

Events Defined by Internet Explorer

 onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate,  onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy,  oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover,  ondragstart, ondrop, onfilterchange, onfocus, onfocusin, onfocusout, onhelp,  onlosecapture, onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend,  onmovestart, onpaste, onpropertychange, onreadystatechange, onresizeend,  onresizestart, onselectstart, ontimeerror 

Element-Specific Attributes

abbr       The value of this attribute is an abbreviated name for a header cell. This might be useful when attempting to display large tables on small screens.

align       This attribute is used to align the contents of the cells within a <tbody> tag. Common values are center , justify , left , and right .

axis       This attribute is used to provide a name for a group of related headers.

background       This nonstandard attribute, which is supported by most browsers, specifies the URL of a background image for the table cell. The image is tiled if it is smaller than the cell's dimensions.

bgcolor       This attribute specifies a background color for a table cell. Its value can be either a named color, such as red , or a color specified in the hexadecimal #RRGGBB format, such as #FF0000 .

bordercolor       This attribute, supported by Internet Explorer and Netscape, is used to set the border color for a table cell. The attribute should be used only with a positive value for the border attribute. The value of the attribute can be either a named color, such as green , or a color specified in the hexadecimal #RRGGBB format, such as #00FF00 .

bordercolordark       This Internet Explorer-specific attribute specifies the darker of two border colors used to create a three-dimensional effect for a cell's borders. It must be used with the border attribute set to a positive value. The attribute value can be either a named color, such
as blue , or a color specified in the hexadecimal #RRGGBB format, such as #00FF00 .

bordercolorlight       This Internet Explorer-specific attribute specifies the lighter of two border colors used to create a three-dimensional effect for a cell's borders. It must be used with the border attribute set to a positive value. The attribute value can be either a named color, such
as red , or a color specified in the hexadecimal #RRGGBB format, such as #FF0000 .

char       This attribute is used to define the character to which element contents are aligned when the align attribute is set to the char value.

charoff       This attribute contains an offset, specified as a positive or negative integer, for aligning characters as related to the char value. A value of 2 , for example, would align characters in a cell two characters to the right of the character defined by the char attribute.

colspan       This attribute takes a numeric value that indicates how many columns wide a cell should be. This is useful for creating tables with cells of different widths.

headers       This attribute takes a space-separated list of id values that correspond to the header cells related to this cell.

height       This attribute indicates the height of the cell in pixels or percentage. Some browsers may have rendering problems with percentage values.

nowrap       This attribute keeps the content within a table cell from automatically wrapping. The nowrap attribute takes no value under HTML but should be set to the value nowrap under XHTML.

rowspan       This attribute takes a numeric value that indicates how many rows high a table cell should span. This attribute is useful in defining tables with cells of different heights.

scope       This attribute specifies the table cells for which the current cell provides header information. A value of col indicates that the cell is a header for the rest of the column below it. A value of colgroup indicates that the cell is a header for its current column group. A value of row indicates that the cell contains header information for the rest of the row it is in. A value of rowgroup indicates that the cell is a header for its row group. This attribute can be used in place of the header attribute and is useful for rendering assistance by nonvisual browsers. This attribute was added very late to the HTML 4.0 specification, and support for this attribute is still minimal in browsers.

valign       This attribute is used to set the vertical alignment for the table cell. The specification defines baseline , bottom , middle , and top . Internet Explorer also supports center , which should be the same as middle .

width       This attribute specifies the width of a cell in pixels or percentage value.

Examples

  <table border="1">   <tr>   <th>  Names  </th>   <th>  Apples  </th>   <th>  Oranges  </th>   </tr>   <tr>   <td>  Bobby  </td>   <td>  10  </td>   <td>  5  </td>   </tr>   <tr>   <td>  Ruby Sue  </td>   <td>  20  </td>   <td>  3  </td>   </tr>   </table>  

Compatibility

HTML 3.2, 4, 4.01
XHTML 1.0, 1.1, Basic

Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1.1, 2, 3, 4, 4.5-4.8, 6, 7
Opera 4-7

Notes

  • The HTML 3.2 specification defines only align , colspan , height , nowrap , rowspan , valign , and width attributes.

  • This element should always be within the tr element.

  • Under the XHTML 1.0 specification, the closing </th> tag ceases to be optional.

<thead> (Table Header)

This element is used to group the rows within the header of a table so that common alignment and style defaults can easily be set for numerous cells. This element might be particularly useful when setting a common head for tables that are dynamically generated.

Standard Syntax

 <thead      align="center  char  justify  left  right"      char="character"      charoff="offset"      class="class name(s)"      dir="ltr  rtl"      id="unique alphanumeric identifier"      lang="language code"      style="style information"      title="advisory text"      valign="baseline  bottom  middle  top">  tr elements only  </thead> 

Attributes Defined by Internet Explorer

 accesskey="key" (5.5)      hidefocus="true  false" (5.5)      language="javascript  jscript  vbs  vbscript" (4)      tabindex="number" (5.5)      unselectable="off  on" (5.5)      valign="center" (4) 

Standard Event Attributes

 onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove,  onmouseout, onmouseover, onmouseup 

Events Defined by Internet Explorer

 onactivate, onbeforeactivate, onbeforecut, onbeforedeactivate, onbeforepaste,  onblur, oncontextmenu, oncontrolselect, oncopy, oncut, ondeactivate, ondrag,  ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onfocus,  onfocusin, onfocusout, onhelp, onlosecapture, onmouseenter, onmouseleave,  onmousewheel, onmove, onmoveend, onmovestart, onpaste, onpropertychange,  onreadystatechange, onresize, onresizeend, onresizestart, onselectstart,  ontimeerror 

Element-Specific Attributes

align       This attribute is used to align the contents of the cells within a <thead> tag. Common values are center , justify , left , and right . The specification also defines a value of char . When align is set to char , the attribute char must be present and set to the character to which cells should be aligned. A common use of this approach would be to set cells to align on a decimal point.

char       This attribute is used to define the character to which element contents are aligned when the align attribute is set to the char value.

charoff       This attribute contains an offset, specified as a positive or negative integer, for aligning characters as related to the char value. A value of 2 , for example, would align characters in a cell two characters to the right of the character defined by the char attribute.

valign       This attribute is used to set the vertical alignment for the table cells with a <thead> tag. The specification defines baseline , bottom , middle , and top . Internet Explorer also supports center , which should be the same as middle .

Example

  <table border="1" bgcolor="yellow" width="80%">   <thead align="center" bgcolor="red" class="footer"   valign="bottom">   <tr>   <td>  This is the Important Table Headline  </td>   </thead>   <tbody class="tablebody">   <tr>   <td>  The contents of the table!  </td>   </tr>   </tbody>   </table>  

Compatibility

HTML 4, 4.01
XHTML 1.0, 1.1

Internet Explorer 4, 5, 5.5, 6
Netscape 6, 7
Opera 5-7

Notes

  • This element is contained only by a <table> tag and contains table rows as delimited by <tr> tags.

  • Under the XHTML 1.0 specification, the closing </thead> tag ceases to be optional.

<title> (Document Title)

This element encloses the title of an HTML document. It must occur within a document's head element and must be present in all valid documents. Meaningful titles are very important because they are used for bookmarking a page and might be used by search engines attempting to index the document.

Standard Syntax

 <title      dir="ltr  rtl"       id="unique alphanumeric identifier"      lang="language code">     </title> 

Events Defined by Internet Explorer

 onlayoutcomplete, onreadystatechange 

Example

  <head><title>  Big Company: Products: Super Widget  </title></head>  

Compatibility

HTML 2, 3.2, 4, 4.01
XHTML 1.0, 1.1, Basic

Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1, 2, 3, 4, 4.5-4.8, 6, 7
Opera 4-7

Notes

  • The title should be the first element found in the head .

  • Meaningful names should provide information about the document. A poor title would be something like "My Home Page," whereas a better title would be "Joe Smith Home."

  • Browsers can be extremely sensitive to the <title> tag. If the title element is malformed or not closed, the page might not even render in the browser.

  • The HTML 2.0 and 3.2 specifications define no attributes for the title element.

<tr> (Table Row)

This element specifies a row in a table. The individual cells of the row are defined by the th and td elements.

Syntax

 <tr      align="center  justify  left  right"      bgcolor="color name  #RRGGBB" (transitional only)      char="character"      charoff="offset"      class="class name(s)"      dir="ltr  rtl"      id="unique alphanumeric identifier"      lang="language code"      style="style information"      title="advisory text"      valign="baseline  bottom  middle  top">  td or th elements only  </tr> 

Attributes Defined by Internet Explorer

 accesskey="key" (5.5)      bordercolor="color name  #RRGGBB" (4)      bordercolordark="color name  #RRGGBB" (4)      bordercolorlight="color name  #RRGGBB" (4)      hidefocus="true  false" (5.5)      language="javascript  javascript  vbs  vbscript" (4)      tabindex="number" (5.5)      valign="center" (4) 

Standard Event Attributes

 onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove,  onmouseout, onmouseover, onmouseup 

Events Defined by Internet Explorer

 onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate,  onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy, oncut, ondeactivate,  ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop,  onfilterchange, onfocus, onfocusin, onfocusout, onhelp, onlosecapture,  onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste,  onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart,  onselectstart, ontimeerror 

Element-Specific Attributes

align       This attribute is used to align the contents of the cells within the element. Common values are center , justify , left , and right .

bgcolor       This attribute specifies a background color for all the cells in a row. Its value can be either a named color, such as red , or a color specified in the hexadecimal #RRGGBB format, such as #FF0000 .

bordercolor       This attribute, supported by Internet Explorer and Netscape, is used to set the border color for table cells in the row. The attribute should be used only with a positive value for the border attribute. The value of the attribute can be either a named color, such as green , or a color specified in the hexadecimal #RRGGBB format, such as #00FF00 .

bordercolordark       This Internet Explorer-specific attribute specifies the darker of two border colors used to create a three-dimensional effect for the cell's borders. It must be used with the border attribute set to a positive value. The attribute value can be either a named color, such as blue , or a color specified in the hexadecimal #RRGGBB format, such as #00FF00 .

bordercolorlight       This Internet Explorer-specific attribute specifies the lighter of two border colors used to create a three-dimensional effect for a cell's borders. It must be used with the border attribute set to a positive value. The attribute value can be either a named color, such as red , or a color specified in the hexadecimal #RRGGBB format, such as #FF0000 .

char       This attribute is used to define the character to which element contents are aligned when the align attribute is set to the char value.

charoff       This attribute contains an offset, specified as a positive or negative integer, for aligning characters as related to the char value. A value of 2 , for example, would align characters in a cell two characters to the right of the character defined by the char attribute.

valign       This attribute is used to set the vertical alignment for the table cells with a <tr> tag. The specification defines baseline , bottom , middle , and top . Internet Explorer also allows center , which should be the same as middle .

Example

  <table width="300" border="1">   <tr bgcolor="red" align="center" valign="middle">   <td>  3  </td>   <td>  5.6  </td>   <td>  7.9  </td>   </tr>   </table>  

Compatibility

HTML 3.2, 4, 4.01
XHTML 1.0, 1.1, Basic

Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1.1, 2, 3, 4, 4.5-4.8, 6, 7
Opera 4-7

Notes

  • This tag is contained only in the <table> , <thead> , <tbody> , and <tfoot> tags. It contains the <th> and <td> tags.

  • The HTML 3.2 specification defines only the align and valign attributes for this element.

  • Under the XHTML 1.0 specification, the closing </tr> tag ceases to be optional.

<tt> (Teletype Text)

This element is used to indicate that text should be rendered in a monospaced font similar to teletype text.

Standard Syntax

 <tt      class="class name(s)"      dir="ltr  rtl"      id="unique alphanumeric identifier"      lang="language code"      style="style information"      title="advisory text">     </tt> 

Attributes Defined by Internet Explorer

 accesskey="key" (5.5)      contenteditable="false  true  inherit"      disabled="false  true" (5.5)      hidefocus="true  false" (5.5)      language="javascript  jscript  vbs  vbscript" (4)      tabindex="number" (5.5)      unselectable="on  off" (5.5) 

Standard Event Attributes

 onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove,  onmouseout, onmouseover, onmouseup 

Events Defined by Internet Explorer

 onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate,  onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy,  oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover,  ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onlosecapture,  onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste,  onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart,  onselectstart, ontimeerror 

Examples

 Here is some  <tt>  monospaced text  </tt>  . Source code in this tag:  <tt>  main() { printf("hello world"); }  </tt>  

Compatibility

HTML 2, 3.2, 4, and 4.01
XHTML 1.0

Internet Explorer 2, 3, 4, 5, and 5.5
Netscape 1, 2, 3, 4, 4.5-4.8, 6, 7
Opera 4-7

Notes

  • This element has been deprecated by the W3C under XHTML 1.1. The look of the tag can be replicated with the CSS properties font or font-family .

<u> (Underline)

This element indicates that the enclosed text should be displayed underlined .

Standard Syntax (Transitional Only)

 <u      class="class name(s)"      dir="ltr  rtl"      id="unique alphanumeric string"      lang="language code"      style="style information"      title="advisory text">     </u> 

Attributes Defined by Internet Explorer

 accesskey="key" (5.5)      contenteditable="false  true  inherit" (5.5)      hidefocus="true  false" (5.5)      language="javascript  jscript  vbs  vbscript" (4)      tabindex="number" (5.5)      unselectable="on  off" (5.5) 

Standard Event Attributes

 onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove,  onmouseout, onmouseover, onmouseup 

Events Defined by Internet Explorer

 onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate,  onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy,  oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover,  ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onlosecapture,  onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste,  onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart,  onselectstart, ontimeerror 

Examples

 Here is some  <u>  underlined text  </u>  .     Be careful with  <u>  underlined  </u>  text; it looks like  <a href="http://www.yahoo.com/">  links  </a>  . 

Compatibility

HTML 3.2, 4, 4.01 (transitional)
XHTML 1.0 (transitional)

Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 3, 4, 4.5-4.8, 6, 7
Opera 4-7

Notes

  • This element has been deprecated by the W3C. Under the strict HTML and XHTML specifications, the <u> tag is not defined. The look provided by this element is supported by the CSS property text-decoration .

  • Underlining text can be problematic because it looks similar to a link, especially in a black-and-white environment.

<ul> (Unordered List)

This element is used to indicate an unordered list, namely a collection of items that do not have
a numerical ordering. The individual items in the list are defined by the li element, which is the only allowed element within a < ul> tag.

Standard Syntax

 <ul      class="class name(s)"      compact="compact" (transitional only)      dir="ltr  rtl"      id="unique alphanumeric identifier"      lang="language code"      style="style information"      title="advisory text"      type="circle  disc  square"> (transitional only)  List items specified by <li> tags  </ul> 

Attributes Defined by Internet Explorer

 accesskey="key" (5.5)      contenteditable="false  true  inherit" (5.5)      hidefocus="true  false" (5.5)      language="javascript  jscript  vbs  vbscript" (4)      tabindex="number" (5.5)      unselectable="on  off" (5.5) 

Standard Event Attributes

 onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, 
 onmouseout, onmouseover, onmouseup 

Events Defined by Internet Explorer

 onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate,  onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy,  oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover,  ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onlosecapture,  onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste,  onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart,  onselectstart, ontimeerror 

Element-Specific Attributes

compact       This attribute indicates that the list should be rendered in a compact style. Few browsers actually change the rendering of the list, regardless of the presence of this attribute. The compact attribute requires no value.

type       The type attribute is used to set the bullet style for the list. The values defined under HTML 3.2 and the transitional version of HTML and XHTML are circle , disc , and square . A user agent might decide to use a different bullet depending on the nesting level of the list, unless the type attribute is used. The type attribute is dropped under the strict versions of HTML 4 and XHTML because style sheets can provide richer bullet control.

Examples

  <ul compact="compact" title="Sushi Short List" type="circle">   <li>  Maguro  </li>   <li>  Ebi  </li>   <li>  Hamachi  </li>   </ul>  <!-- Common but bad example -->  <ul>  Indentation using lists should not be used, though it is common.  </ul>  <!-- Correct list nesting -->  <ul compact title="Sushi Short List" type="circle">   <li>  Item 1  <ul>   <li>  Item A  </li>   <li>  Item B  </li>   </ul></li>   <li>  Item 2  </li>   </ul>  

Compatibility

HTML 2, 3.2, 4, 4.01
XHTML 1.0, 1.1, Basic

Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1, 2, 3, 4, 4.5-4.8, 6, 7
Opera 4-7

Notes

  • HTML 2.0 supports only the compact attribute.

  • The HTML 3.2 specification supports compact and type .

  • Under the strict HTML and XHTML specifications, the ul element does not support the compact attribute or the type attribute. Both of these attributes can be safely replaced with style rules.

  • Due to XHTML's deprecation of attribute minimization, the compact attribute must have a quoted attribute when used in the transitional variant:

      <ul compact="compact"></ul>  
  • Many Web page designers and page development tools use the <ul> tag to indent text. The only element that should occur within a ul element is li , so such markup does not conform to standards. However, this common practice is likely to continue.

  • Since the content model of ul says list items should be the only item within <ul> tags. Nested lists should occur within <li> tags rather than outside them as they are commonly found.

  • Style sheets provide much better support for bullet control. See Appendix B or Chapter 10 for more information.

<var> (Variable)

This element is used to indicate a variable (an identifier that occurs in a programming language or a mathematical expression). The element is logical, although enclosed text is generally rendered in italics.

Standard Syntax

 <var      class="class name(s)"      dir="ltr  rtl"      id="unique alphanumeric value"      lang="language code"      style="style information"      title="advisory text">     </var> 

Attributes Defined by Internet Explorer

 accesskey="key" (5.5)      contenteditable="false  true  inherit" (5.5)      hidefocus="true  false" (5.5)      language="javascript  jscript  vbs  vbscript" (4)      tabindex="number" (5.5)      unselectable="on  off" (5.5) 

Standard Event Attributes

 onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove,  onmouseout, onmouseover, onmouseup 

Events Defined by Internet Explorer

 onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate,  onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy,  oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover,  ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onlosecapture,  onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste,  onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart,  onselectstart, ontimeerror 

Examples

 Assign the value 5 to the variable  <var>  x  </var>  . The variable  <var>  total  </var>  holds the total order value. 

Compatibility

HTML 2, 3.2, 4, 4.01
XHTML 1.0, 1.1, Basic

Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1, 2, 3, 4, 4.5-4.8, 6, 7
Opera 4-7

Notes

  • As a logical element, var is a perfect candidate for style sheet binding.

  • The HTML 2.0 and 3.2 specifications support no attributes for this element.

<wbr> (Word Break)

This nonstandard element is used to indicate a place where a line break can occur if necessary. This element is used in conjunction with the nobr element, which is used to keep text from wrapping. When used this way, wbr can be thought of as a soft line break in comparison to a <br> tag. This element is common to many Netscape and Microsoft implementations , though it is not part of any HTML standard.

Proprietary Syntax

 <wbr      id="unique alphanumeric value"> 

Example

  <nobr>  A line break can occur here  <wbr>  but not elsewhere, even if the line is really  long.  </nobr>  

Compatibility

No standards support

Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1.1, 2, 3, 4, 4.5-4.8

Notes

  • Older versions of Internet Explorer documentation defined class , language , style , and title for this tag. However, they have little meaning, given this tag's purpose, and have since been eliminated from the documentation, though they may effectively be recognized in some manner by the browser parser.

  • Though this is an empty element and should be written as <wbr /> under XHTML, it does not need to be. It is not standard and will not validate anyway.

  • Standards-based browsers, such as Mozilla and Opera, do not support this tag but oddly seem to support <nobr> .

xml (XML Data Island)

This proprietary element introduced by Microsoft can be used to embed islands of XML (Extensible Markup Language) data into HTML documents; this will work only under Internet Explorer 5.0 or later. An < xml> tag can be used to reference outside data sources using the src attribute, or surround XML data in the HTML document itself.

Internet Explorer Syntax

 <xml     id="unique alphanumeric value"     src="url of xml data file">  ...embedded xml code...  </xml> 

Events Defined by Internet Explorer

 ondataavailable, ondatasetchanged, ondatasetcomplete, onreadystatechange,  onrowenter, onrowexit, onrowsdelete, onrowsinserted 

Element-Specific Attributes

src       This attribute references an external XML data file.

Examples

 <!-- This code embeds xml data directly into a document.      All code between the xml tags is not HTML, but a      hypothetical example of xml. -->     <xml id="tasty">    <combomeal>       <burger>        <name>Tasty Burger</name>          <bun bread="white">             <meat />             <cheese />             <meat />          </bun>       </burger>       <fries size="large" />       <drink size="large" flavor="Cola" />    </combomeal> </xml>     <!-- This code fragment uses the src attribute to reference an       external file containing xml data. -->     <xml src="combomeal.xml"></xml> 

Compatibility

No standards support

Internet Explorer 5, 5.5, 6

Notes

  • Support for the <xml> tag is limited to Internet Explorer 5 or better. Mozilla's approach is more focused on embedding HTML within XML documents.

  • For a more detailed discussion of the element and demonstrations of its use, refer to "Embedding XML into HTML Documents" in Chapter 18.

<xmp> (Example)

This deprecated but still widely supported element indicates that the enclosed text is an example. Example text generally is rendered in a monospaced font, and the spaces, tabs, and returns are preserved, as with the pre element.

Syntax (Defined by HTML 2; Deprecated Under HTML 4)

 <xmp> </xmp> 

Attributes Defined by Internet Explorer

 accesskey="key" (5.5)      class="class name(s)" (4)      contenteditable="false  true  inherit" (5.5)      hidefocus="true  false" (5.5)      id="unique alphanumeric value" (4)      lang="language code" (4)      language="javascript  jscript  vbs  vbscript" (4)      style="style information" (4)      tabindex="number" (5.5)      title="advisory text" (4)      unselectable="on  off" (5.5) 

Events Defined by Internet Explorer

 onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate,  onbeforeeditfocus, onbeforepaste, onblur, onclick, oncontextmenu, oncontrolselect,  oncopy, oncut, ondeactivate, ondblclick, ondrag, ondragend, ondragenter,  ondragleave, ondragover, ondragstart, ondrop, onfocus, onfocusin, onfocusout,  onhelp, onkeydown, onkeypress, onkeyup, onlosecapture, onmousedown, onmouseenter,  onmouseleave, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel,  onmove, onmoveend, onmovestart, onpaste, onpropertychange, onreadystatechange,  onresize, onresizeend, onresizestart, onselectstart, ontimeerror 

Example

  <xmp>  This is a large block of text used as an example. Note that returns       as well as    S P A C E S are preserved.  </xmp>  

Compatibility

HTML 2

Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1, 2, 3, 4, 4.5-4.8, 6, 7
Opera 4-7

Note

  • This element was first deprecated under HTML 3.2, yet all major browsers continue to support it, and it is well documented and even extended for Internet Explorer. The <pre> tag or style sheets should be used instead of this tag.



 <  Day Day Up  >  


HTML & XHTML
HTML & XHTML: The Complete Reference (Osborne Complete Reference Series)
ISBN: 007222942X
EAN: 2147483647
Year: 2003
Pages: 252
Authors: Thomas Powell

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net