如何使html忽略作为文本一部分的代码? [英] How to make html ignore code that is part of text?
问题描述
我需要在我的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 "<", the ampersands ("&") to
"&", and the greater-than signs (">") to ">".
deko wrote:
I need to include code snippets in my html document
You need to use < and > instead of < and >.
See http://tranchant.plus.com/web/html-tutorial/characters
--
Mark.
http://tranchant.plus.com/
> Change the less-than signs ("<") to "<", the ampersands ("&") to"&", and the greater-than signs (">") to ">".
Thanks!!
这篇关于如何使html忽略作为文本一部分的代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!