Home > Article > Web Front-end > How to display html code directly in html
This article will introduce to you how to directly display html code in html. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
Baidu has listed a lot of practices, and I feel that many of them have not been tested before making nonsense. I will summarize them here.
Baidu refers to the <code><code> and <code><pre class="brush:php;toolbar:false"></pre> tags. My test results are as follows:
1.<code>
<code> <h1>hello</h1> <h2>hello</h2> <h3>hello</h3> <h4>hello</h4> <h5>hello</h5> <h6>hello</h6> </code>
Rendering:
The code is still rendered and fails. It is said that inline elements are rendered, but they are still rendered if they are changed to span.
2.<pre class="brush:php;toolbar:false"></pre>
Code:
<pre class="brush:php;toolbar:false"> <h1>hello</h1> <h2>hello</h2> <h3>hello</h3> <h4>hello</h4> <h5>hello</h5> <h6>hello</h6>
Rendering:
Same as above render.
3.
Code:
<xmp> <h1>hello</h1> <h2>hello</h2> <h3>hello</h3> <h4>hello</h4> <h5>hello</h5> <h6>hello</h6> </xmp>
Rendering:
Display directly And the format is preserved! feasible!
Recommended learning: html video tutorial
The above is the detailed content of How to display html code directly in html. For more information, please follow other related articles on the PHP Chinese website!