Style Sheets
  Home arrow Style Sheets arrow Using the Padding-Top CSS Property for Ima...
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 for Image Replacement
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-12-10

    Table of Contents:
  • Using the Padding-Top CSS Property for Image Replacement
  • Review: Fahrner's approach with web page links
  • Langridge's image replacement method
  • Integrating the CSS styles into an XHTML document

  • 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 for Image Replacement


    (Page 1 of 4 )

    In this tenth part of the series, I show you how to start using the image replacement method created by Stuart Langridge. It uses the “padding-top” CSS property to mask the text of the targeted web page element while keeping its background image visible.

    For many beginning web designers, the purpose of most image replacement methods available today may seem understandably pointless. Having at their disposal a powerful combination of client-side technologies that permits them to easily build the structure of web pages, then define their visual presentation via CSS, and finally add to them a dynamic, high-responsive behavior with JavaScript, it’s natural to see the implementation of any of these methods as an annoying, tricky process that should be avoided by all means, whenever possible.

    Fortunately, this is only a first impression that vanishes quickly in favor of a more mature opinion. The faster you realize the importance of image replacement in professional web design, the better. Without the existence of these methods, designers would have to live in a limited world where polishing the appearance of any text-based HTML element would imply altering its semantic meaning in all sorts of cruel ways.

    This may sound a bit exaggerated, but reality tells a different story, trust me. For instance, how can an H1 element house a logo image, without modifying the markup or inserting the image directly via an <img> tag? Of course, this is merely an example, but the truth is that image replacement can be used in multiple cases and scenarios with very good results.

    To demonstrate how useful image replacement can actually be, in previous chapters of this series I covered in depth the methods created by Mike Rundle and Todd Fahrner, which make decorating text-based HTML elements with a background image a no-brainer process. While these methods are quite possibly the most used at this time, there’s yet another handy approach developed by Stuart Langridge (http://www.kryogenix.org/code/browser/lir/) that bases its functionality on the “padding-top” CSS property.

    So, in the next few lines I’ll be showing how to implement Langridge’s image replacement method, so you can understand its underlying logic and use it within your own web pages. Now, let’s get started!

    More Style Sheets Articles
    More By Alejandro Gervasio


       · This part of the series shows how to implement Langridge’s image replacement method,...
     

    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 10 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek