Home arrow Style Sheets arrow Page 3 - Assigning Negative Indentation to Hyperlinks for Image Replacement
STYLE SHEETS

Assigning Negative Indentation to Hyperlinks for Image Replacement


In this third part of a six-part series on image replacement techniques, I demonstrate how easy it is to apply the image replacement method developed by Mike Rundle simultaneously to H1, H2 and <a> elements on the same XHTML page.

Author Info:
By: Alejandro Gervasio
Rating: 4 stars4 stars4 stars4 stars4 stars / 3
November 24, 2009
TABLE OF CONTENTS:
  1. · Assigning Negative Indentation to Hyperlinks for Image Replacement
  2. · Review: applying image replacement to H1 and H2 HTML headers
  3. · Adding a fancier style to some web page links
  4. · Including the CSS code in a sample web page

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Assigning Negative Indentation to Hyperlinks for Image Replacement - Adding a fancier style to some web page links
(Page 3 of 4 )

As I expressed in the section that you just read, using the previous image replacement technique with some web page links is indeed a no-brainer process that can be tackled with minor hassles. To demonstrate this, in the lines to come I’ll define a brand new CSS class called “fancy_link,” which will use the following background image to polish the visual appearance of targeted links:

Having created this basic graphic, here’s the CSS class that performs the replacement task in all the web page elements that have been assigned the aforementioned “fancy_link” CSS class:

.fancy_link {

display: block;

width: 200px;

height: 50px;

background: url(fancy_link.png) center center no-repeat;

text-indent: -9999px;

}

Since my goal here is to demonstrate how to apply image replacement to some hyperlinks, the previous “fancy_link” CSS class includes a “display: block” declaration. If you plan to use this approach with block-level elements, though, make sure you remove that line of code.

The other declarations that make up this CSS class speak for themselves, so I won’t spend more time explaining its inner workings. Instead, it’s time to see how this class can be used along with the ones created before to apply this IR approach to H1, H2 and <a> elements, all at the same time, on the same web document!

Illustrating this process will be the last step of this tutorial, so click on the link below and read the final segment.


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