Forum Moderators: Robert Charlton & goodroi
<a href="/register" title="Register as a new user">
<img class="myRegisterButton" src="thesmallestgifintheworld.gif" alt="Register now">
</a>
img.myRegisterButton {
width:100px;
height:40px;
background-image: url('sprites.png');
background-attachment: norepeat;
background-position: 0px 0px;
margin: 0 auto;
padding: 0;
}
img.myRegisterButton:hover {
background-position: -100px 0px;
}
img.myRegisterButton:active {
background-position: -200px 0px;
}
<a href="/register">Register now</a> a:link { display:block; width:100px; height:40px; } <a href="/register"><span>Register now</span></a>
a { display:block; width:100px; height:40px; background:
url(sprite.gif) no-repeat ? ?;}
a:hover {background-position: ? ?;}
a span {position: absolute; left:-9999px;}
display: none; on the <span> to hide the text, but that apparently is not read by Assistive Technologies as widely as the other methods though that may not be an issue, also I'm not sure which of these, if any, Google "ignores" either. visbility:hidden; on the span is another option.. ah choices.. Personally I'd recommend against using the above, especially in light of the recent 'Heads Up' thread: [webmasterworld.com...]
display: none; method, IE6/7 also used to have some problems with it, so I think you'll find that is why that methiod is not recommended by some.. to me it's just habit to use the text-indent method and I researched recently if there was any reason to change my mind, there wasn't, so until such times as we are told that all AT's (Assistive Technolgies) have agreed on a definite best practice I can't see a SE having the power to diss any method over another *as long as you use it legitimately* @SuzyUK, I can't be positive, but I think I have been penalised in a previous life for using the absolute position image replacement technique. I would think it would be very easy for the 'bots to detect this. What has your experience been?
the "gif" trick would certainly work, but is "alt" text any better for your purposes than real text, or is a 'forcing'? - reminds me of gif spacer tricks in tables
maybe (definite maybe) under a manual test your proposed method might actually fail before any of the 'display' methods as that *could* almost seem like a way of keyword stuffing.....