How to display html code in browser
Display plain text in html
How to display html code as text in web page...
How to Display HTML Tags as Plain Text in HTML?
In HTML, certain characters like <, >, “, and & are reserved for defining HTML elements and attributes.
To display these characters as plain text instead of interpreting them as part of the HTML structure, you need to use special codes called HTML entities.
HTML Entities for Special Characters
To show reserved characters as plain text, use the following HTML entities:
Sign | Description | Entity name | Entity number |
---|---|---|---|
< | Less than(start of HTML element) | < | < |
> | Greater than(end of HTML element) | > | > |
“ | Double quotation | " | " |
& | Ampersand ( beginning of HTML entity) | & | & |
Methods for Displaying HTML Tags as Plain Text
There are two main approaches to displaying HTML tags as plain text:
1.
Using the <plaintext> Element
Note: The <plaintext> element is deprecated, meaning it is no longer supported in modern web development. Some older browsers might still support it, but using it is not recomm