+ 1
How to display a tag on web page?
This seemed very obvious to me at first. Just write the text <p> '<h1>' and '<h2>' are both header tags. <p> But to my greatest supprise the header tags still behave as tags and not as text. How can you fix this?
3 Respuestas
+ 5
@Ashit Aryan is wrong...
To display tags in html content, you need to mask at least the opening angular brackets, else tags will be interpreted as real tags elements to display, as you've noticed...
Code linked below will show you how do it, with html entities:
https://code.sololearn.com/WsKE6rqpS39l/?ref=app
And anyway, reference about them:
https://www.sololearn.com/Discuss/180550/?ref=app
https://www.w3schools.com/html/html_entities.asp
+ 1
If you want to show any tag on the webpage,just use <p> tag before it and after it. Eg: Just suppose you want to display the code of whole html document.
<!doctype html>
<html>
<head>
<title>page title....</title><style>......</style></head>
<body>
<pre><p>
<!doctype html>
<html>
<head>
<title>page title....</title><style>......</style></head>
<body>...................
</body>
</html>
(Now ,close p)</p>
</pre>
</body>
</html>
It's quite simple. Isn't it?
0
@Ashit Aryan thank you. Can you please try it in the playground and paste the link here?