Techniques Behind Modern Web
4 Feb
Well, you don’t need to be a Photoshop pro to create glossy text that seems very trendy today (Web 2.0 styles? hmm).

Here is a simple CSS trick to show you how to create gradient text effect with a PNG image (pure CSS, no Javascript or Flash). Just put an empty <span> tag in the heading and apply the background image overlay using the CSS position:absolute property. This trick works on most browsers: Firefox, Safari, Opera, and even Internet Explorer 6 (with a small CSS hack).
The code looks like this:
<h1><span></span>Just Talk About Web</h1>
Use the CSS to define styling of the H1. Make sure that you set position property to relative;.
1 2 3 4 5 6 7 8 | h1 { /* optional styling, you can use whatever you wish */ font: bold 300%/100% "Lucida Grande"; color: #000; /* now, this is important */ position:relative; } |
Now the gradient: we put a transparent PNG as a background image for the span element and set position property to absolute so it can go above the text.
1 2 3 4 5 6 7 8 | h1 span, h2 span { background: url(gradient-glossy.png) repeat-x; position: absolute; display: block; width: 100%; height:27px; } |
Unfortunately, not all browsers support PNG transparency (IE6, for example). So for those browsers, please include this as well.
1 2 3 4 5 6 7 | <!--[if lt IE 7]> h1 span { background: none; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='gradient-glossy.png', sizingMethod='scale'); } <![endif]--> |
Now, see what we have:

Look cool? Please note that you can use any text color you want and you can vary gradient effect as long your gradient color is the same as your background color.
View demo here and download demo files here.
Free Website Magazine: Know more than your competitors with Website Magazine
Don't forget to subscribe
so you don't miss out on future posts!
Looks very similar to http://www.cssglobe.com/post/1227/css-text-gradient
@ comment #3 (David)
If this is similar with your link check this out:
http://www.webdesignerwall.com/tutorials/css-gradient-text-effect/
Even the code is the same
@Dan: Not really though I use the same technique (not new) to get glossy effect.
That’s really cool. I am glad _someone_ is having success with transparency in IE6. I tried using it to round some corners in a recent project, and I had to conclude it was impossible. (If you think you have a solution let me know, but I came across several sources saying my desired result wasn’t possible–even with the javascript hacks.)
Nice tutorial
Still…nothing beats the quality of the image made in Photoshop.
Which is why there is a huge visual difference between sites made by code-geeks and designers
.
You want glossy…check out http://www.dezinerfolio.com/2007/05/06/ultimate-web-20-layer-styles/
Nifty trick though!
@jolly-lamma: That is definitely true. But tips like this can help you get a website out a little bit faster. In the early days, the colours aren’t always locked down and you can’t afford to spend THAT much time in photoshop. But once the colours, etc are chosen, then you need someone who is realyl good with photoshop to make it great.
Cheers,
Paul
And why CSS-developers can’t add so useful function as gradiend only by CSS, without any image! I’d be happy, when I write only background: #000 #fff; and have a black-white gradient! IMHO, it would be cool!
P.S. Exuse me about my errors in English. I am from Ukraine.
CSS Web 2.0 Glossy Text - CSS Gradient Effect | Just Talk About Web…
CSS Web 2.0 Glossy Text - CSS Gradient Effect | Just Talk About Web…
[...] Css web 2.0 glossy textYou donâ
[...] Just type your business name, select a logo sample and click “Create” button to go. I can say all logos it created for me look very attractive with trendy web 2.0 glossy style. [...]
[...] 6)CSS Web 2.0 Glossy Text- You don’t need to be a Photoshop pro to create Web 2.0 glossy text that seems very trendy today. [...]
[...] 6)CSS Web 2.0 Glossy Text- You don’t need to be a Photoshop pro to create Web 2.0 glossy text that seems very trendy today. [...]
[...] CSS Web 2.0 Glossy Text – CSS Gradient Effect | Just Talk About Web [...]
[...] got this post from http://justtalkaboutweb.com/2008/02/04/css-web-20-glossy-text/ and I feel you may put this too to good news. I’ve tried it and it’s a sure winner. How to [...]
[...] CSS Web 2.0 Glossy Text (1,945 pageviews) [...]
[...] 6)CSS Web 2.0 Glossy Text- You don’t need to be a Photoshop pro to create Web 2.0 glossy text that seems very trendy today. [...]
[...] CSS Web 2.0 Glossy Text from Just Talk About Web. [...]
[...] CSS Web 2.0 Glossy Text from Just Talk About Web. [...]
[...] CSS Web 2.0 Glossy Text from Just Talk About Web. [...]