How to show HTML code inside HTML without Rendering

We can show html inside html by using using the html entity
‘<‘ as ‘&lt;’ and the ‘>’ as ‘&gt;’

Normally we use like this in html .

<h1> This is H1 tag </h1>

But it the result renders html and shows like this

This is h1 tag

So will We will use this To prevent the rendering

&lt;h1&gt; This is H1 tag &lt;/h1&gt;

The result

<h1> This is H1 tag </h1>

Now there is a full example which demonstrate this

Copy the code and try by yourself.



<!DOCTYPE html>
<html>
<head>

</head>
<body>

<h1> This is H1 tag </h1>
&lt;h1&gt; This is also H1 tag &lt;/h1&gt;
    

</body>
</html>

    
    
    

Related Posts

How to HTML open link in new in tab in browser
July 3, 2024

We can add this target=”_blank” in the <a> tag to open link in new tab Example code <!DOCTYPE html> <head> </head> <body> &lt!– Opens in the same tab –> <a href=”https://en.wikipedia.org/wiki/Main_Page”>Visit Wikipedia (same tab)</a> <br> &lt!– Opens in a new tab –> <a href=”https://en.wikipedia.org/wiki/Main_Page” target=”_blank”>Visit Wikipedia (new tab)</a> </body> </html> Copy Code

Change button text with jQuery
July 3, 2024

Its essential to change t he button text in some applications . For example Like button. If the current is “Like”, after click on the button it the button text will be “Liked” jquery makes process efficient. <!DOCTYPE html> <html> <head> <script src=”https://code.jquery.com/jquery-3.7.1.min.js”></script> </head> <body> <button class=”like-button”>Like</button> <script> $(document).ready(function(){ $(‘.like-button’).click(function(){ var buttonText = $(this).text(); if […]

How to prevent text selection in html
April 28, 2024

Its necessary to prevent text selection when the text is ui feature, to make the webpage more professional. We can prevent the text from selecting by using this in css You cannot select this text You can select this text example code