What is the <samp> element in HTML?

In HTML, the <samp> element is used to enclose in-line text representing sample output from a computer program.

The contents of the <samp> element are typically rendered using the browser’s default monospaced font.

Syntax

<samp> output content </samp>

Code

The following code demonstrates the usage of the <samp> element in HTML. The content that we want to display as the sample output of a program is written within the opening and closing tags, <samp> and </samp>.

  • HTML
New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources