Style Sheets
  Home arrow Style Sheets arrow Indenting H2 Elements as a CSS Image Repla...
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

Indenting H2 Elements as a CSS Image Replacement Technique
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-11-23

    Table of Contents:
  • Indenting H2 Elements as a CSS Image Replacement Technique
  • Review: image replacement with an H1 header
  • Styling H2 elements
  • Applying the same IR technique to H1 and H2 elements

  • 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


    Indenting H2 Elements as a CSS Image Replacement Technique


    (Page 1 of 4 )

    In this second part of a six-part series on image replacement techniques, I demonstrate how to use the technique you learned in the previous part on all of the H2 headers contained in a sample web document. This technique is fairly straightforward, so you shouldn’t have any major problems using it within your own web pages.

    Image replacement (IR) is a set of straightforward methodologies that allows you to hide from view the text wrapped by a web page element, while revealing its background image. Based mostly on the functionality brought by CSS (even when Flash and JavaScript are used in some cases with the same purpose), IR lets web designers build eye-catching text-based elements, such as HTML headers, lists and links, without messing significantly with the structural markup with tags that have no real semantic meaning within the context of a web document.

    Since most IR techniques rely heavily on the power of CSS to perform the corresponding replacement process, it's easy to use them with relative confidence, as they’re entirely independent of whether or not scripting is enabled in the client. There is a decent variety of IR approaches that can be implemented easily nowadays; each of them has its own pros and cons, especially when it comes to potential accessibility issues. 

    Many of these concepts should already be familiar to you if you read the first part of this series. In that tutorial, I explained in detail how to build more attractive H1 HTML elements by using the IR technique developed originally by Mike Rundle. This technique bases its functionality on simply assigning a huge negative value to the “text-indent” CSS property of the element being styled, in this way hiding its text from display, while its background image remains visible.

    Quite possibly, the most significant pitfall of this technique is that if the pertinent background image isn’t downloaded by the browser, the selected web page element will become inaccessible. On the other hand, the positive side of Mike Rundle’s approach is that it requires no additional markup and it’s very easy to implement with multiple web page elements.

    Based on the versatility offered by this technique, in this second article of the series I’ll be demonstrating how to use it to give a more pleasant appearance to all of the H2 headers contained on a web page.

    Ready to learn how this will be done? Then start reading the next section!

    More Style Sheets Articles
    More By Alejandro Gervasio


       · This second article of the series shows how to use the image replacement method...
     

    STYLE SHEETS ARTICLES

    - Creating Framed Pictures with CSS
    - Using a CSS Shading Effect to Decorate Images
    - Decorating Images with CSS
    - Finishing a Drop-Down Menu with the Hover CS...
    - Creating a Drop-Down Menu with the Hover CSS...
    - Building CSS-based Tooltips with the Hover P...
    - Rediscover the Hover CSS Pseudo-Class
    - Langridge`s Image Replaceement Technique: A ...
    - Using the Padding-Top CSS Property with H2 H...
    - Using the Padding-Top CSS Property for Image...
    - Using Fahrner`s Improved Image Replacement M...
    - Using Empty Span Tags with H2 Headers for Im...
    - Image Replacement with Empty Span Tags
    - Wrapping Hyperlinks with Span Tags for Image...
    - Spanning H2 Elements for Image Replacement







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