Tag: <code>

<code> Syntax

Syntax Diagram for <code>
Opening Tag Content Closing Tag
<code> text </code>

<code> Description

The <code>. . . </code> tags define the text that occurs between them to be computer code. This tag is an example of "logical markup," as opposed to "physical markup." Logical markup defines what text is, rather than how it looks (as physical markup does). It is likely, though not guaranteed, that the "<code>" tags will cause text that occurs between them to be displayed in a monospaced typewriterish font (similar to the physical markup "<tt>").

The advantage to logical markup is that, regardless of how the affected text appears, it is always considered to be what the markup says it is. For example, computer code is always computer code, regardless of the font that any particular browser uses to represent it. The disadvantage to logical markup is that you cannot be sure how the text will appear (which may be important).

Conversely, the advantage to physical markup is that you can be sure of what the text will look like: when you want a typewriter font for a piece of text, you'll get typewriter font. The disadvantage to physical markup is that you may not be able to tell, just by looking at the font, what the text is supposed to represent (which may be important).

<code> Example

This markup: Increment the variable: <code>I = I + 1</code>. . . .causes the following to be displayed:
Increment the variable: I = I + 1.

Last Modified: