如何在没有浏览器解释代码的情况下包含代码行? [英] How do I include lines of code without the browser interpreting them?

查看:74
本文介绍了如何在没有浏览器解释代码的情况下包含代码行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用记事本来创建一个网站,但我遇到了一个问题。每当我包含一个html标签,例如< p>在另一行中,< / p>< p>不显示。

我也尝试使用代码标签,但它不起作用

< p> 标签

I have been using notepad in order to create a website but I have encountered a problem. Whenever I include an html tag such as <p> within another line, the </p><p> does not show up.
I tried using the code tag as well but it did not work

the <p> tag

推荐答案

你需要对它们进行编码:

You need to encode them:
For
<p>



你需要把它们写成:


You need to write them as:

&lt;p&gt;

等等。

.NET提供HTML编码字符串的方法: HttpServerUtility.HtmlEncode方法(字符串)(System.Web) [ ^ ]


这篇关于如何在没有浏览器解释代码的情况下包含代码行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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