Tutorials

KodeKite Tools

HTML
Flexbox
SVG
Canvas
HTML Tutorial

More


HTML Samp Element
Samp Element

HTML samp element defines program output from computer code and support fixed letter size and spaces.

Syntax

<samp>Content</samp>

Or

<tag><samp>Content</samp></tag>


You can use samp element any where within an HTML document.


Example

x = 5 is output of program


Samp is a pair tag and output of samp element is differet from other text like you can see in above example.


Practice Task

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


  • Write programming code
  • Use <samp> element to display output

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


Solution

int x = 6, y = 5, z = x - y;
document.write(z);

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