HTML <samp> tagS2C Home   « HTML <samp> tag

Definition

The <samp> tag is used to define sample computer code.

Example


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

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.


<samp class="classname">Sample computer code here</samp>

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


<samp id="idname">Sample computer code here</samp>

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


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

title - specifies extra information about the content.


<samp title="information about the content">Sample computer code here</samp>

Language Attributes

dir - specifies the directional flow of the content.


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

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

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


<samp lang="en">Sample computer code here</samp>

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


<samp xml:lang="fr">Sample computer code here</samp>

Document Event Attributes

NONE

Form 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 -->
<samp onkeydown="go()">Sample computer code here</samp>

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 -->
<samp onkeypress="go()">Sample computer code here</samp>

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


<!-- Executes the go() function -->
<samp onkeyup="go()">Sample computer code here</samp>

Mouse Event Attributes

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


<!-- Executes the go() function -->
<samp onclick="go()">Sample computer code here</samp>

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


<!-- Executes the go() function -->
<samp ondblclick="go()">Sample computer code here</samp>

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 -->
<samp onmousedown="go()">Sample computer code here</samp>

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


<!-- Executes the go() function -->
<samp onmousemove="go()">Sample computer code here</samp>

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


<!-- Executes the go() function -->
<samp onmouseout="go()">Sample computer code here</samp>

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


<!-- Executes the go() function -->
<samp onmouseover="go()">Sample computer code here</samp>

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


<!-- Executes the go() function -->
<samp onmouseup="go()">Sample computer code here</samp>

go to home page Homepage go to top of page Top