<html> <head> </head> <body> 12344 </body> </html>
以上一个网页的源码,那么我现在要把源码 输出-
那么用pre标签怎么办?
<pre>
这里写你想写的代码~~~~
</pre> 就是这样用的
<html>
<head>
</head>
<body>
12344
<pre>
<html>
<head>
</head>
<body>
12344
</body>
</html>
</pre>
</body>
</html> 这么写为什么不对?
pre 元素中允许的文本可以包括物理样式和基于内容的样式变化,还有链接、图像和水平分隔线。当把其他标签(比如 <a> 标签)放到 <pre> 块中时,就像放在 HTML/XHTML 文档的其他部分中一样即可。
所以你得这样
<pre><html><br><head><br></head><br><body><br> 12344<br></body><br></html></pre>
注意 百度修改了代码 & lt; & gt;(没有空格)分别代表< >
用textarea呢?怎么用?
textarea 没问题的
<textarea name="textarea" id="textarea" cols="45" rows="5"> <html> <head> </head> <body> <code><br> </textarea>
这次明白了,再加10分吧,多谢了。
<pre></pre>这个标签可以将其包起来的文字排版、格式,原封不动的呈现出来。你输入的东西被原封不动的 输出,包括你输入的空格之类的,不用 和<BR>等来表示空格或者回车了.
用于显示源码的确是不错的方案
<pre>
$(
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>
<html>
<head>
</head>
<body>
12344
</body>
</html>
</pre>
</body>
</html> 这么写为什么不对?
哦,你要在per中写html的代码啊,那你要记得
<>不能直接写成<>,要写出实体形式
< 小于号 < < > 大于号 > > & 和号 & & " 引号 " " ' 撇号 ' (IE不支持) '
以上就是html pre标签使用详解的详细内容,更多请关注Gxl网其它相关文章!
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did72340