How to Hide an HTML Text Code

Techwalla may earn compensation through affiliate links in this story. Learn more about our affiliate and product review process here.
Hidding text can be done using HTML comment tags.

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.

Advertisement

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.

Video of the Day

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.

Advertisement

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.

Advertisement

Step 5

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

Video of the Day

Advertisement

Advertisement

references

Report an Issue

screenshot of the current page

Screenshot loading...