Tutorials

KodeKite Tools

HTML
Flexbox
SVG
Canvas
HTML Tutorial

More


HTML Code Element
Code Element

HTML code element defines a piece of programming code and support fixed letter size and spacing.

Syntax

<code>Content</code>

Or

<tag><code>Content</code></tag>


You can apply code element to any element and use any where within a HTML document.


Example

var x = 5;
var y = 7;
var z = x + y;
document.write(z);

Code is a pair tag and output of code element is fixed text like you can see in above example.


Practice Task

Open notepad or any other text editor, follow the following points.


  • Select some lines of code
  • Use <code> element and write code in a page

save file with name task.html or task.htm and then open it using any browser and see results.


Solution

f = ma

Don't forget code is non empty element which means it always comes in pair.