1. Home
  2. Computing & Technology
  3. Web Design / HTML

How to Hide Links Using CSS
Use Classes and a Cursor Element to Make the Link Disappear

By , About.com Guide

First, before you do this you should be aware that hiding links makes them virtually unusable to the average viewer. Also, if your readers use older browsers, this tip won't hide the links from them. However, if you want to create a scavenger hunt or easter egg on your site, this is an interesting way to hide links.

Create a Class

You can put your styles in-line within the link tag you want to hide, but in order to be able to use it over and over, you should create a class within your style sheet, in the <head> of your document:

<style type="text/css" media="all">
<!--
.hiddenlink {
  color: #000; /* same color as the surrounding text */
  text-decoration: none; /* to remove the underline */
  cursor: text; /* to make the cursor stay as a text cursor, not the hand */
-->
</style>

Add the Class to Your Link

Change your link to that class:
<a href="URL" class="hiddenlink">...</a>

Finally, Hide the Menu Notification

When you roll your mouse over a link, the menu of many Web browsers shows the URL where the link will take you. This could give away the location of your hidden link. To fix this, you need to use some JavaScript:
<a href="URL" class="hiddenlink" onmouseover="self.status='';return true;">...</a>

Explore Web Design / HTML
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. About.com Web Design A to Z
  5. Books
  6. About Web Design Book
  7. AWD: Chapter 10
  8. How to Hide Links Using CSS>

©2009 About.com, a part of The New York Times Company.

All rights reserved.