anti spam an email address

class=”aligncenter” so, on the web, it’s pretty much accepted that whatever you put out there can and will be used by someone somewhere, sometimes exploitively.  one way this can cause frustration and headaches is putting your email address on your site.  now, some people (including myself) have started doing this myemail @ mydomain . com or myemail<at>mydomain<dot>com thing.  which is fine, but not very pretty.  so i came up with a neat little hack that has the same effect but looks prettier.  check it out:

<span style="margin-left: -.2em">&nbsp;</span>

now you can put that snippet where the space would go in the myemail @ mydomain . com example.  what it does is substitute your space with &nbsp; (which is ascii code for a space character), and then hides what it did with the margin-left: -.2em.  the final result would be this:

myemail<span style="margin-left: -.2em">&nbsp;</span>@<span style="margin-left: -.2em">&nbsp;
</span>mydomain<span style="margin-left: -.2em">&nbsp;</span>.<span style="margin-left: -.2em">
&nbsp;</span>com

and this is what it looks like:

myemail @ mydomain . com