In the interest of sharing, I'm gonna put up a little bit here about my favorite image replacement technique. I do not claim this as my own. As far as I can tell, the link I posted above points to the guru genious who came up with the idea.
The idea is like this. You wanna show some highly stylized text in place of your strictly marked-up text. CSS can't do what you want. You can't depend on user on the other end having that 'perfect' font you want...using <img> for text is VERY unusable...what's a guy to do?
You apply a background image to your properly marked-up XHTML!
Make your image, let's say a title. Note its size. Let's pretend 100px tall.
Add that to your stylesheet.
code:
<style type='text/css'>
h1{
background:transparent url(fancyH1.png) center center no-repeat;
}
......
<body>
<h1>Regular Title</h1>
Hey! Now we have the image AND the text. Make that text go away.
OK. Add some padding to the h1 in the stylesheet. Make your padding equivalent to the size of the image. While you're at it, change the height of the image to 0.
code:
<style type='text/css'>
h1{
padding-top:100px;
height:0;
background:transparent url(fancyH1.png) center center no-repeat;
overflow:hidden;
}
......
<body>
<h1>Regular Title</h1>
This technique works wonderfully on modern browsers that implement the box model properly. Unfortunately, the browser with the marketshare doesn't fit that description.
Time for the ol' Tantek box model hack...
code:
<style type='text/css'>
h1{
padding-top:100px;
height:100px;
background:transparent url(fancyH1.png) center center no-repeat;
overflow:hidden;
voice-family: "\"}\"";
voice-family:inherit;
height:0;
}
......
<body>
<h1>Regular Title</h1>
Great!
Uh...now it's broken in Opera...1 more change.
code:
<style type='text/css'>
h1{
padding-top:100px;
height:100px;
background:transparent url(fancyH1.png) center center no-repeat;
overflow:hidden;
voice-family: "\"}\"";
voice-family:inherit;
height:0;
}
html>body h1{
height:0;
}
......
<body>
<h1>Regular Title</h1>
There you have it. One perfectly pretty title. One uberly-usable document.
Resources:
image replacement
box model hack
[This message has been edited by mobrul (edited 04-01-2004).]