Home arrow Style Sheets arrow Page 3 - Creating Gradients for Web Page Headers with PNG Images
STYLE SHEETS

Creating Gradients for Web Page Headers with PNG Images


Welcome to the third part of the series, “Using PNG images to build background effects.” This series teaches you how to create eye-catching web page gradients that not only make use of transparent PNG graphics to achieve this visual effect, but will be displayed correctly by a number of modern browsers, including Internet Explorer 6.

Author Info:
By: Alejandro Gervasio
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
May 28, 2008
TABLE OF CONTENTS:
  1. · Creating Gradients for Web Page Headers with PNG Images
  2. · Reintroducing the AlphaImageLoader Microsoft’s proprietary filter
  3. · Decorating headers of a web page
  4. · Linking the gradient CSS class to the structural markup

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Creating Gradients for Web Page Headers with PNG Images - Decorating headers of a web page
(Page 3 of 4 )

If you found it extremely easy to decorate the background of a web page using a PNG-based gradient, then you’ll probably grasp how to apply the same visual effect to some of its section headers. Basically, the procedure is quite straightforward, and it requires defining a generic “sectionheader” CSS class that can be quickly linked to all of the headers of a sample web page.

So, having explained how this approach is going to function, pay attention to the definition of the aforementioned “sectionheader” CSS class. It’s as follows:


.sectionheader{

background: #fff url(bg.png) left top repeat-x;

}

/* use the * html CSS hack to render an alpha-based transparent background */

* html . .sectionheader {

background: #fff;

filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='bg.png',
sizingMethod='scale');

}


As you can see, the above “.sectionheader” CSS class has been defined in such a way that it will be applied normally to selected elements of a web page when working with non-IE browsers. However, in Internet Explorer, the corresponding “AlphaImageLoader” filter will be used instead.

This CSS hack will make all of the gradients that use a transparent PNG image display correctly on most browsers. As you’ll certainly recall, this simple hack was used when building complete web page gradients. Its flexibility allows it to be applied, for instance, to all the <h2> headers of a sample web page.

The demonstration of how to decorate all of the <h2> headers with PNG-based gradients will be explained in detail in the last section of this tutorial. Therefore, click on the link shown below and keep reading, please.


blog comments powered by Disqus
STYLE SHEETS ARTICLES

- CSS Combinators: Working with Child Combinat...
- CSS Combinators: Using General Siblings
- Intro to CSS Combinators
- CSS Semicircles and Web Page Headers
- Drawing Circular Shapes with CSS3 and Border...
- More CSS Pagination Link Templates
- CSS Pagination Links
- Animated CSS3 Image Gallery: Advanced Transi...
- CSS3 Animated Image Gallery: Transitions
- CSS3 Properties: Fixed Heights with box-sizi...
- CSS3 Properties: Altering Strokes and 3D Eff...
- CSS3 Properties: Text-Stroke
- CSS3 Transitions: Width and Height Properties
- Creating a Drop Down Menu in CSS3
- Intro to CSS Transitions

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials