Use <pre> tag to a large section of code to your web page

grammar:

<pre>语言代码段</pre>

The main role of <pre> tag: preformatted text. Surrounded by the text in the pre elements usually reserved spaces and line breaks.

The following code:

<pre>
    var message="欢迎";
    for(var i=1;i<=10;i++)
    {
        alert(message);
    }
</pre>

Display the results in the browser as follows:

In the above example can be seen in the code space, line breaks are retained. If the previous method, you need to enter Enter <br>sign, you need to enter a space&nbsp;

Note:<pre>  tag does not just use the time to display the source code of the computer, you need to pre-show format when it can be used only in a web page <pre>a common application tag is used to display the source code of the computer.

Guess you like

Origin www.cnblogs.com/iBoundary/p/11414306.html