Home arrow Style Sheets arrow Indenting H2 Elements as a CSS Image Replacement Technique
STYLE SHEETS

Indenting H2 Elements as a CSS Image Replacement Technique


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.

Author Info:
By: Alejandro Gervasio
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
November 23, 2009
TABLE OF CONTENTS:
  1. · Indenting H2 Elements as a CSS Image Replacement Technique
  2. · Review: image replacement with an H1 header
  3. · Styling H2 elements
  4. · Applying the same IR technique to H1 and H2 elements

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Indenting H2 Elements as a CSS Image Replacement Technique
(Page 1 of 4 )

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!


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