HTML code tag

<code> tag defines a computer coded style of a piece of text. For instance, a computer program.

Example


<p><code>Here code starts. But it does not present pre-defined style of coding</code></p>

Try </>

Specific uses

Its uses are given below

file name

Example


<p><code>table.html</code> page is about the tables.</p>
Try</>

a program

Example

<pre><code>
var x,y;
 function sum(x,y){
	document.write(x+y);
 }
 sum(5,4);
</code></pre>
Try</>

syntax highlighting

Example

<pre><code>
<span style="color:blue; font-family:italic;">var</span> x,y;
<span style="color:red; font-family:italic;">function</span>{
	
}
</pre></code>
Try</>

Global Attributes

All the global attribute are applicable on the code element.

Tag omission

Both opening and closing tags are necessary for the code tag.



Was this article helpful?

 

Email:

Message:

Get the newsletter