Related Articles

An anchor tag is the tag that makes clickable links to other HTML pages or Internet resources. When you place anchor tags on your business’ Web pages to create links, people can click those links and navigate to the URLs associated with the anchors. You'll probably want those anchors to appear all the time because they’re part of your website. However, if one of the sites to which an anchor’s URL points ever goes down, you may wish to hide the anchor and its URL. You can do it without deleting the anchor from your Web page.

1. Launch your HTML editor (e.g. Notepad) and open a Web page document that has an anchor you wish to hide.

2. Locate the document’s <body> tag and its </body> tag. Everything between those two tags defines the content that appears on the Web page. The <body> tag will be clos to the top of the document; the </body> tag will be closer to the bottom.

3. Find the anchor tag that you wish to hide. A typical anchor tag looks like the one shown below: <a href="http://www.whitehouse.gov/">Click here to visit the White House site</a> The text that reads, “Click here to visit the White House site” is the text that you see in your browser when you view it in your browser. If you need help finding the anchor, find it in your browser first, remember its text and then locate the same text in your HTML document.

4. Paste the following text snippet on a blank line before the anchor: <!--

5. Paste the text snippet shown below on a blank line after the anchor: --> If you perform this task using the anchor example described previously, the anchor code would appears as shown below: <!-- <a href="http://www.whitehouse.gov/">Click here to visit the White House site</a> --> Doing this tells browsers to hide the HTML element that exists between the two text snippets you added.

6. Save the HTML document and view it in your browser to verify that the anchor and URL do not appear.

Tip

Add text snippets to as many anchors as you like to make them disappear from your Web page. When you want the anchor to appear again, delete the text snippets you added.

About the Author

After majoring in physics, Kevin Lee began writing professionally in 1989 when, as a software developer, he also created technical articles for the Johnson Space Center. Today this urban Texas cowboy continues to crank out high-quality software as well as non-technical articles covering a multitude of diverse topics ranging from gaming to current affairs.