I want to share some piece of html code using <pre>
and <code>
tag. But problem is when I share this code it has converted into html files.
example i want to share this code
<!DOCTYPE html>
<html>
<title>HTML Tutorial</title>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
but when I share this it has converted into a html. how can share as a code so that viewer can view the html tags and code.
You need to encode special characters. You can use online tools to encode characters. Here is the encoded version of your desired snippet:
<!DOCTYPE html> <html> <title>HTML Tutorial</title> <body> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body> </html>
This online tool was used: https://www.web2generators.com/html-based-tools/online-html-entities-encoder-and-decoder