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

Detailed explanation of the use of html pre tags

黄舟
Release: 2017-07-08 10:56:38
Original
3457 people have browsed it

How to use the pre tag in html

<html>
<head>
</head>
<body>
12344
</body>
</html>
Copy after login

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">
     这里写你想写的代码~~~~
Copy after login

That’s how it is used

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

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 tag) inside the

 block, they are treated as if they were placed in other parts of the HTML/XHTML document. <br/>So you have to do this</p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false"><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

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

This 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 
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>
Copy after login
<html>
<head>
</head>
<body>
    12344
<pre class="brush:php;toolbar:false">
<html>
<head>
</head>
<body>
    12344
</body>
</html>
Copy after login
Copy after login

Why is it wrong to write like this?

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

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

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!

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template