1. Technology
Send to a Friend via Email

The CODE Tag



< Previous | HTML 4.01 Tags | XHTML 1.0 Elements | Next >

Free HTML Class | HTML Validators

CODE Description:

The CODE tag indicates that the enclosed text is computer code or programming code.

The CODE tag is a semantic tag that gives the enclosed text a specific meaning for the computer. These types of tags are used more for style and to markup your text more meaningfully than for layout or design.

CODE Web Browser Support:

HTML Versions

CODE Attributes:

Global attributes and event attributes.

CODE End Tag:

</code> REQUIRED

CODE Contents:

CDATA Usually text. The following tags are valid within the CODE tag:
a, abbr, acronym, applet, b, basefont, bdo, big, br, button, cite, code, dfn, em, font, i, iframe, img, input, kbd, label, map, object, q, s, samp, script, select, small, span, strike, strong, sub, sup, tt, u, var

CODE Valid Context:

The CODE tag is valid within the following tags:
a, abbr, acronym, address, applet, b, bdo, big, blockquote, body, button, caption, center, cite, code, dd, del, dfn, div, dt, em, fieldset, font, form, h1, h2, h3, h4, h5, h6, i, iframe, ins, kbd, label, legend, li, noframes, noscript, object, p, q, s, samp, small, span, strike, strong, sub, sup, td, th, tt, u, var

CODE Usage:

standard code example

  This is a typical HTML header:

CODE Special Notes:

  • Most browsers display the code tag in a monospace font.
  • You should not use this tag to get monospaced text, if you need that, you should use the font-family style property.
  • Don”t confuse the CODE tag with the CODE attribute of the APPLET tag.

More CODE Information:

< Previous | HTML 4.01 Tags | XHTML 1.0 Elements | Next >

©2014 About.com. All rights reserved.