Home >Web Front-end >HTML Tutorial >Detailed explanation of the use of html pre tags

Detailed explanation of the use of html pre tags

黄舟
黄舟Original
2017-07-08 10:56:383474browse

How to use the pre tag in html

<html>
<head>
</head>
<body>
12344
</body>
</html>

The source code of the above web page, then I want to output the source code now -
What should I do if I use the pre tag?

<pre class="brush:php;toolbar:false">
     这里写你想写的代码~~~~

That’s how it is used

<html>
<head>
</head>
<body>
    12344
<pre class="brush:php;toolbar:false">
<html>
<head>
</head>
<body>
    12344
</body>
</html>

Why is it wrong to write it like this?

Allowed text in pre elements can include physical styles and content-based style variations, as well as links, images, and horizontal dividers. When placing other tags (such as the 3499910bf9dac5ae3c52d5ede7383485 tag) inside the e03b848252eb9375d56be284e690e873 block, they are treated as if they were placed in other parts of the HTML/XHTML document.
So you have to do this

<pre class="brush:php;toolbar:false"><html><br><head><br></head><br><body><br>    12344<br></body><br></html>

Note that Baidu has modified the code & lt; & gt; (without spaces) respectively represents < how to use?

textarea No problem

<textarea name="textarea" id="textarea" cols="45" rows="5">
<html>
<head>
</head>
<body>
<code><br>
</textarea>

I understand this time, just add 10 points, thank you.

e03b848252eb9375d56be284e690e873bc5574f69a0cba105bc93bd3dc13c4ecThis tag can display the layout and format of the enclosed text intact. What you input will be output unchanged, including the spaces you input, and there is no need to use 82c2f54f4cf245029ffb326befd49b3f to represent spaces or carriage returns.
It is indeed a good solution for displaying source code

<pre class="brush:php;toolbar:false">
$(
function() {
$("#selectBox").mousemove(
function(event) {
$("span:eq(0)").html($("#selectArea").position().left);
$("span:eq(1)").html(event.offsetX);
if ($("#selectArea").css("position") == "absolute") {
$("#selectArea").css({ left: event.clientX - $("img").offset().left });
$("#selectArea").css({ top: event.clientY - $("img").offset().top });
}
if ($("#selectArea").css("position") == "relative") {
$("#selectArea").css({ left: -(300 - event.offsetX) });
$("#selectArea").css({ top: event.offsetY });
}
}
);
}
);
</per>
<html>
<head>
</head>
<body>
    12344
<pre class="brush:php;toolbar:false">
<html>
<head>
</head>
<body>
    12344
</body>
</html>

Why is it wrong to write like this?

Oh, if you want to write HTML code in per, then you have to remember that
a8093152e673feb7aba1828c43532094 cannot be written directly as a8093152e673feb7aba1828c43532094, but must be written in entity form

< 小于号 < < 
> 大于号 > > 
& 和号 & & 
" 引号 " " 
&#39; 撇号  &#39; (IE不支持) &#39;

The above is the detailed content of Detailed explanation of the use of html pre tags. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn