printing “<html>” using html

可紊 提交于 2019-12-17 06:16:27

问题


How do I print the "html" tag, including '<' and '>'? How can I do this for any tag, without using text areas and Javascript?


回答1:


Use HTML character references:

&lt;html&gt;

Should output

<html>



回答2:


Try doing:

&lt;html&gt;



回答3:


Special characters in HTML, such as '<', '>', '"' and '&' can be printed using the following format:

&name;

where name would be replaced by a character name. The most common would then be

&lt;   =   <    (less than)
&gt;   =   >    (greater than)
&amp;  =   &    (ampersand)
&quot; =   "    (double quote)

So to write <html> you would write in HTML:

&lt;html&gt;



回答4:


If you want to display <html> literally, use reference to represent the tag open delimiter < and the tag close delimiter >, for example:

&lt;html&gt;

This will then be displayed as:

<html>




回答5:


do this

&lt;html&gt;



回答6:


Please have a look at html entities

You can use the entity names directly in your html.

<p> &lt;html&gt; </p> will render as <html>.

likewise

<p> 3 &gt; 2 </p> will render as 3 > 2.

Try all the html entities and check the output in this Fiddle




回答7:


&lt;html&gt;

my output code <HTML>




回答8:


To print an HTML tag write

&lt;html> 

or &lt;html&gt;

both gives the same output : <html>



来源:https://stackoverflow.com/questions/3505047/printing-html-using-html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!