Home arrow Style Sheets arrow Using the Padding-Top CSS Property with H2 Headers for Image Replacement
STYLE SHEETS

Using the Padding-Top CSS Property with H2 Headers for Image Replacement


In this penultimate installment of the series, I demonstrate how to apply Langridge’s image replacement method to all of the H2 headers of a trivial XHTML document. The inner workings of this approach are very easy to grasp, so you shouldn’t have major problems using it within your own web pages.

Author Info:
By: Alejandro Gervasio
Rating: 5 stars5 stars5 stars5 stars5 stars / 3
December 15, 2009
TABLE OF CONTENTS:
  1. · Using the Padding-Top CSS Property with H2 Headers for Image Replacement
  2. · Review: Langridge's image replacement method with an H1 element
  3. · Extending Langridge's method to H2 headers
  4. · Binding the CSS to the structural markup

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Using the Padding-Top CSS Property with H2 Headers for Image Replacement
(Page 1 of 4 )

Despite the variety of image replacement methods created in the last few years, the good news is that learning how to implement them is a fairly straightforward process, even for web designers with only an average background in CSS and (X)HTML.

Frankly speaking, many of these methods have one thing in common, which makes it even easier to grasp their driving logic. They use one or multiple CSS properties for hiding from view the inner section of text of a web page element, while keeping the assigned background image visible.

In previous chapters of this series, I took an in-depth look at the image replacement techniques developed by Mike Rundle and Todd Fahrner respectively, since these are the most popular in professional web design. Rundle’s method doesn’t require writing additional markup and makes clever use of the “text-indent” CSS property to perform the corresponding image replacement.

On the other hand, Fahrner’s technique comes in two different flavors. Both of them require coding a couple of extra <span> tags: the first approach utilizes the tags for directly wrapping the text of the targeted web page element, while the second option moves the “spans” out of the text section, which solves the accessibility problem caused by broken background images.

Given the diversity of image replacement methods available, you might think that list stops here, right? Well, not so fast; there’s yet another approach that might be appealing to you, since it sits between the methods described above. In this case, I’m talking about Stuart Langridge’s technique, which I already started implementing in the last tutorial for decorating an H1 header of an XHTML page.

Since this approach uses the “padding-top” property to do its thing, it provides enough flexibility to be applied to other web page elements as well. Thus, in the lines to come I’ll be showing how to use this handy method for styling the H2 headers of the same XHTML document.

Want to see how this will be accomplished in a few simple steps? Then start reading now!


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 9 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials