Quick Tip #1 - Image Replacement
Problem
Image replacement can be easily abused; but when used properly (like replacing logo text) it's a great resource.
Image replacement without extra markup usually means setting text-indent:-9999px
on your link. And this works great great. But in a lot of browsers it leaves a focus outline that runs way off the page to the left on click.
We need to keep the outline there for accessibility reasons, so most developers just leave it alone. But there's a way to make, both, designers and accessibility gurus happy.
Problem CSS
#branding h1 a{
display:block;
height:70px;
width:289px;
background:url(../images/logo.png) no-repeat 0 0;
text-indent:-9999px;
}
Goal
Solution
By adding overflow:hidden
to the link we can cut off the extended :focus outline.
Solution CSS
#branding h1 a{
display:block;
height:70px;
width:289px;
background:url(../images/logo.png) no-repeat 0 0;
text-indent:-9999px;
overflow:hidden;
}