如何使html忽略作为文本一部分的代码? [英] How to make html ignore code that is part of text?

查看:84
本文介绍了如何使html忽略作为文本一部分的代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在我的html文档中包含代码片段,如下所示:


<?xml version =" 1.0"编码= QUOT; UTF-8英寸?>

< configuration>

< appSettings>

< add key =" ConnectionString" Password = password; Persist Security

Info = True; User ID = newuser; Initial Catalog = catalog; Data Source = localhost" />

< / appSettings>

< / configuration>


如果我尝试将其放入常规文件,我收到错误......我已经尝试了

将其封入< pre>标签,但这没有帮助。如何将这段代码

样本存入文件?


谢谢

解决方案

deko写道:

我需要在我的html文档中包含代码片段,如下所示:

<?xml version =" 1.0"编码= QUOT; UTF-8英寸?>
< configuration>
< appSettings>
< add key =" ConnectionString" " Password = password; Persist Security
Info = True; User ID = newuser; Initial Catalog = catalog; Data Source = localhost" />
< / appSettings>
< / configuration>

如果我尝试将其放入常规文档中,我会收到错误...我已经试着把它封在< pre>标签,但这没有帮助。如何将此代码
样本放入文档中?




将少于标志("<")更改为&& <" ;,&""& amp;"和<"""&"&"和<""" & gt;"。


deko写道:

我需要在我的html文档中包含代码片段



您需要使用& lt;和& gt;而不是<和> ;.


参见 http://tranchant.plus.com/web/html-tutorial/characters


-

马克。
http://tranchant.plus.com/


>将小于号(<)改为& lt;,将&符号(&)改为

"& amp;" ;和大于标志(>)到& gt;。




谢谢!!


I need to include code snippets in my html document, something like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ConnectionString" "Password=password;Persist Security
Info=True;User ID=newuser;Initial Catalog=catalog;Data Source=localhost" />
</appSettings>
</configuration>

If I try to put this in a regular document, I get errors... I''ve tried
enclosing it in <pre> tags, but that didn''t help. How do I get this code
sample into a document?

Thanks

解决方案

deko wrote:

I need to include code snippets in my html document, something like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ConnectionString" "Password=password;Persist Security
Info=True;User ID=newuser;Initial Catalog=catalog;Data Source=localhost" />
</appSettings>
</configuration>

If I try to put this in a regular document, I get errors... I''ve tried
enclosing it in <pre> tags, but that didn''t help. How do I get this code
sample into a document?



Change the less-than signs ("<") to "&lt;", the ampersands ("&") to
"&amp;", and the greater-than signs (">") to "&gt;".


deko wrote:

I need to include code snippets in my html document



You need to use &lt; and &gt; instead of < and >.

See http://tranchant.plus.com/web/html-tutorial/characters

--
Mark.
http://tranchant.plus.com/


> Change the less-than signs ("<") to "&lt;", the ampersands ("&") to

"&amp;", and the greater-than signs (">") to "&gt;".



Thanks!!


这篇关于如何使html忽略作为文本一部分的代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆