Introduction
The Code tag is used for indicating the source code of a programming language. The code tag represents any variable name, type of variable, a filename, a computer program, or any type of code that a computer would recognize. This tag is best used for short pieces of code because it does not preserve white space.
<cite
class=class names
id=specify unique id
style="style information > </cite>
Attributes Introduced by HTML5 |
accesskey |
contenteditable |
contextmenu |
data-X |
draggable |
hidden |
itemid |
itemprop |
itemref |
itemscope |
itemtype |
spellcheck |
tabindex |
HTML5 Event Attributes
|
onabort |
onblur |
oncanplay |
oncanplaythrough |
onchange |
onclick |
oncontextmenu |
ondblclick |
ondrag |
ondragend |
ondragenter |
ondragleave |
ondragover |
ondragstart |
ondrop |
ondurationchange |
onemptied |
onended |
onerror |
onfocus |
onformchange |
onforminput |
oninput |
oninvalid |
onkeydown |
onkeyup |
onload |
onkeypress |
onloadeddata |
onloadedmetadata |
onloadstart |
onmousedown |
onmousemove |
onmouseout |
onmouseover |
onmouseup |
onmousewheel |
onpause |
onplay |
onplaying |
onprogress |
onratechange |
onreadystatechange |
onscroll |
onseeked |
onseeking |
onselect |
onshow |
onstalled |
onsubmit |
onsuspend |
ontimeupdate |
onvolumechange |
onwaiting |
Code:
- <!DOCTYPE html>
- <html>
- <head>
- <title></title>
- </head>
- <body>
- <p>
- In this line, I am using the <code> tag. You should use
- <code>Server.MapPath()</code>
- to get virtual directory.
- </p>
- <p>
- In the below line, I am not using <code> tag. To show the effect of the code tag.
- <br />
- You should use Server.MapPath() to get virtual directory.
- </p>
- <code>
- <p>
- <code>
- <strong>Programming language</strong>
- </code>
- </p>
- </code>
- <p>
- Code tag is used for indicating a source code of programming language. This code
- represent any variable name, type of variable, syntax of code, a filename, a computer
- program, or any type of code that the computer would recognize. This tag is best used
- for a short piece of code because it does not preserve white space.
- </p>
- <blockquote>
- <code>
- <strong>Syntax:</strong>
- </code>
- <br />
- <code>con.Open();
- <br />
- cmd.ExecuteNonQuery();
- <br />
- Response.Redirect("~/home.aspx");
- </code>
- </blockquote>
- </body>
- </html>
Output
Internet Explorer
Chrome
FireFox
Safari