HTML HTML Tutorial HTML Forms HTML Graphics HTML Media HTML APIs HTML Tags



HTML Tag: samp

The HTML Tag: samp is used to define a sample output or example of a computer program or code. It is used to display the output of a program or code in a web page. The samp tag is a part of the HTML5 specification and is supported by all modern web browsers.

The samp tag is used to display the output of a program or code in a web page. It is often used in conjunction with the code tag to display both the code and the output. The samp tag is also used to display the output of a command or a user input.

Brief Explanation about HTML Tag: samp

The samp tag is a block-level element that is used to display the output of a program or code. It is similar to the pre tag, but it is used specifically for displaying the output of a program or code. The samp tag is often used in conjunction with the code tag to display both the code and the output.

The samp tag is used to display the output of a program or code in a web page. It is often used in technical documentation or tutorials to show the expected output of a program or code. The samp tag is also used to display the output of a command or a user input.

Code Examples in Per Tags

Here are some examples of how the samp tag can be used:

Example 1:


<p>The output of the program is: <samp>Hello World!</samp></p>

The above code will display the output of the program "Hello World!" in the web page.

Example 2:


<p>Enter your name: <input type="text"></p>
<p>The user entered: <samp>John Doe</samp></p>

The above code will display a text box where the user can enter their name. The output of the user input will be displayed using the samp tag.

Example 3:


<p>To run the program, type: <samp>python program.py</samp></p>

The above code will display the command to run a Python program in the web page.

References

Activity