Sunday, August 27, 2006

Hiding Page Content

Suppose a circumstance arises where - for whatever reason - you want to hide page content from human users but not search engine spiders.

The following code uses CSS to create two divs and then puts one div behind the other by using Z-Index. Human visitors to your site see the top div, search engine spiders see both. Be warned: users surfing in FireFox with CSS turned off will see all content as well.

<style type="text/css">
margin: 0px 0px 0px 0px;

z-index: 5;
position: absolute;
width: 100%;
height: 75px;
background-color: #ffffff;

z-index: 1;
position: relative;
width: 300px;
height: 75px;

<TABLE cellpadding=5 cellspacing=0 width="100%">
<div id="absdiv1">
This could the div with your header stuff in it,
or your logo in the upper left

<div id="reldiv2">
You can put all kinds of stuff in this div and no
one can see it; links, keywords, even images

No comments: