Style Sheets
  Home arrow Style Sheets arrow Using the Padding-Top CSS Property with H2...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
STYLE SHEETS

Using the Padding-Top CSS Property with H2 Headers for Image Replacement
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2009-12-15

    Table of Contents:
  • Using the Padding-Top CSS Property with H2 Headers for Image Replacement
  • Review: Langridge's image replacement method with an H1 element
  • Extending Langridge's method to H2 headers
  • Binding the CSS to the structural markup

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


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


    (Page 1 of 4 )

    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.

    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!

    More Style Sheets Articles
    More By Alejandro Gervasio


       · This penultimate installment of the series demonstrates how to apply Langridge’s...
     

    STYLE SHEETS ARTICLES

    - Styling Pseudo Classes with the RGBA CSS3 Pr...
    - Controlling Overall Transparency of an HTML ...
    - Altering the Border Opacity of an HTML Eleme...
    - The RGBA CSS3 Property: an Overview
    - Using Span Tags to Include Logos in Web Pages
    - Using a Single H1 Element to Include Logos i...
    - Combining Divs and H1 Elements to Include Lo...
    - Semantically Including Logos in Web Pages
    - Adding Text Indentation to Style Code Blocks...
    - Decorating Line Numbers in Code Blocks Style...
    - Changing the Color of Code Lines with CSS
    - Using Ordered Lists to Style Code Blocks wit...
    - Using a Zebra Background Effect to Style Cod...
    - Displaying Rounded Corners Built with CSS3 i...
    - Building Rounded Corners with CSS3`s -webkit...







    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 9 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek