How to Hide an HTML Text Code

By Scott Stanchak

Deleting text from your website may not be entirely necessary. Especially if you need that text to appear again one day. Instead of getting rid of the text, you can hide it through the use of an HTML tag. The text will remain in the HTML code, but not in a user's browser window.

Things You'll Need

  • HTML editor

Step 1

Launch your HTML editor. Select "File" and "Open" from the program's navigation bar. Choose the file that you wish to hide the text.

Step 2

Locate the text within the HTML document you want to hide. Place your cursor before the first character of that block of code.

Step 3

Type "<" followed by "!---" (no quotes and no spaces) before the first character of the text you want to hide. This open comment tag tells Internet browsers to begin hiding everything from this point forward.

Step 4

Type "---" followed by ">" (no quotes and no spaces) at the end of the block of text you want to hide. This closed comment tag ensures that the HTML code between the open comment tag and this point will be hidden when viewed with an Internet browser.

Step 5

Save your HTML document. Preview it in a browser window before uploading to your server.