html5 Site Icon CSS3 Site Icon CSS Site Icon

HTML4 Reference

HTML <code> tag

Definition

The <code> tag is used to define computer code text.

Example


<code>This text will look like computer code.</code>

Required Attributes

NONE

Optional Attributes

NONE

Common Attributes

class - specifies a classname for the element allowing you to apply the style of the predefined class to the content.


<code class="classname">Computer code text here</code>

id - specifies a unique id for the element allowing you to apply the style of the predefined id to the content.


<code id="idname">Computer code text here</code>

style - specifies an inline style for the element allowing you to apply the style to the content.


<code style="color:red;text-align:left">Computer code text here</code>

title - specifies extra information about the content.


<code title="information about the content">Computer code text here</code>

Language Attributes

dir - specifies the directional flow of the content.


<!-- The text will flow from left to right -->
<code dir="ltr">Computer code text here</code>

<!-- The text will flow from right to left -->
<code dir="rtl">Computer code text here</code>

lang - specifies a language code for the content of the element.


<code lang="en">Computer code text here</code>

xml:lang - specifies a language code for the content of the element in XHTML documents.


<code xml:lang="fr">Computer code text here</code>

Document Event Attributes

NONE

Form Event Attributes

NONE

Image Event Attributes

NONE

Keyboard Event Attributes

onkeydown - The JavaScript code to be run when an element is in focus and keyboard key is pressed.


<!-- Executes the go() function -->
<code onkeydown="go()">Computer code text here</code>

onkeypress - The JavaScript code to be run when an element is in focus and keyboard key is pressed down and released.


<!-- Executes the go() function -->
<code onkeypress="go()">Computer code text here</code>

onkeyup - The JavaScript code to be run when an element is in focus and keyboard key is released.


<!-- Executes the go() function -->
<code onkeyup="go()">Computer code text here</code>

Mouse Event Attributes

onclick - The JavaScript code to be run when a mouse is clicked on the element.


<!-- Executes the go() function -->
<code onclick="go()">Computer code text here</code>

ondblclick - The JavaScript code to be run when a mouse is double clicked on the element.


<!-- Executes the go() function -->
<code ondblclick="go()">Computer code text here</code>

onmousedown - The JavaScript code to be run when the mouse button is pressed down while the cursor is over the element.


<!-- Executes the go() function -->
<code onmousedown="go()">Computer code text here</code>

onmousemove - The JavaScript code to be run when the mouse button is moved.


<!-- Executes the go() function -->
<code onmousemove="go()">Computer code text here</code>

onmouseout - The JavaScript code to be run when the mouse cursor moves off an element.


<!-- Executes the go() function -->
<code onmouseout="go()">Computer code text here</code>

onmouseover - The JavaScript code to be run when the mouse cursor moves over an element.


<!-- Executes the go() function -->
<code onmouseover="go()">Computer code text here</code>

onmouseup - The JavaScript code to be run when the mouse button is released while the cursor is over the element.


<!-- Executes the go() function -->
<code onmouseup="go()">Computer code text here</code>


<cite> tag    << Prev          Next >>   <col> tag

go to home page Homepage go to top of page Top

HTML Elements

The complete set of HTML elements also known as HTML tags from the latest HTML 4.01 Specification.

Click the links for more information on individual tags and their attributes.

<!--...-->

<!DOCTYPE>

<a>

<abbr>

<acronym>

<address>

<applet>

<area />

<b>

<base />

<basefont />

<bdo>

<big>

<blockquote>

<body>

<br />

<button>

<caption>

<center>

<cite>

<code>

<col />

<colgroup>

<dd>

<del>

<dfn>

<dir>

<div>

<dl>

<dt>

<em>

<fieldset>

<font>

<form>

<frame />

<frameset>

<h1> - <h6>

<head>

<hr />

<html>

<i>

<iframe>

<img />

<input />

<ins>

<isindex />

<kbd>

<label>

<legend>

<li>

<link />

<map>

<menu>

<meta />

<noframes>

<noscript>

<object>

<ol>

<optgroup>

<option>

<p>

<param />

<pre>

<q>

<s>

<samp>

<script>

<select>

<small>

<span>

<strike>

<strong>

<style>

<sub>

<sup>

<table>

<tbody>

<td>

<textarea>

<tfoot>

<th>

<thead>

<title>

<tr>

<tt>

<u>

<ul>

<var>