What is the Computer Code element in HTML? How many types?


In the previous article, Taimienphi.vn introduced you to Responsive Web Design in HTML, in the next article below, Taimienphi.vn will introduce you about Computer Code element in HTML.


The computer uses a unique format and style text to display code-related messages. Card code used to display computer code on the website. HTML includes several elements available for marking computer code.

Computer Code element in HTML

Table of Contents:
1. The kbd element is in HTML
2. The samp element for the program output
3. Code element for computer code (computer code)
4. The var element is in HTML
5. Summary

first. Kbd element in HTML

Element kbd in HTML represents user input, such as keyboard input or voice commands.

Text is placed around the card kbd usually displayed in monospace font format.

For example: Here is an example of the kbd element in HTML:

phan tu computer code in html

The results returned after applying the kbd element should look like this:

phan tu computer code in html 2

2. The samp element for the program output

Element samp in HTML represents the output of a computer program or system.

Text is placed around the card samp usually displayed in monospace font format.

For example: Here is an example of an samp element in HTML:

phan tu computer code in html 3

The result returned after applying the samp element has the following form:

phan tu computer code in html 4

3. Code element for computer code (computer code)

Element code in HTML defines a computer code snippet.

Text is placed around the card code usually displayed in monospace font format.

Example 1: The following is an example of a code element for computer code:

phan tu computer code in html 5

The result returned after applying the code element has the following form:

phan tu computer code in html 6

Note: code element does not contain spaces and line breaks.

To fix this, we can place the element code inside the element pre.

Example 2: Refer to the example below:

phan tu computer code in html 7

The result returned after placing the code element inside the pre element has the following form:

phan tu computer code in html 8

4. The var element is in HTML

Element var in HTML is used to define a variable.

Variables can be variables in mathematical expressions or variables in programming contexts.

For example: below is an example of a var element in HTML:

phan tu computer code in html 9

The result returned after applying the var element in HTML has the following form:

phan tu computer code in html 10

5. Summary

The following is a list of the Computer Code elements in HTML:

phan tu computer code in html 11

https://thuthuat.taimienphi.vn/phan-tu-computer-code-rong-html-50807n.aspx
The above article Taimienphi.vn has just introduced you to the Computer Code element in HTML. In the next article, Taimienphi.vn will introduce you further Entities in HTML. In addition, if you have any questions or questions, you can leave your comments in the comment section below the article.

.

Add a Comment

Your email address will not be published. Required fields are marked *