Doing it with style
My recent 'sliding-doors' examples have led me into looking at the :first-letter pseudo-element as a method of holding a second background image using just a the link text.
I thought that I should document my findings for anyone else who wishes to persue this for their own purposes.
The above demonstration shows how the first letter can be styled using the available properties as listed below.
I believe that Opera, Netscape and Mozilla get all of these right. Firefox get the padding, background image position and the underline wrong. BUT IE5, IE6 and even IE7 gets this very wrong.
In IE the underscore goes through the letter, the padding and margins are wrong, the vertical-align and :hover are not styled, the background image is wrongly positioned, but worst of all the border widths are wrongly displayed. The widths should increase clockwise around the first-letter, but IE reverses this and the borders increase in an anti-clockwise direction. The color order, however, is correct.
Opera - as I would expect
Safari - underline narrow
Mozilla - negative margins
Netscape - negative margins
Firefox linux - padding and height
Firefox - padding, margin, height, background image and underline
IE 5.01 - no styling
IE 5.5 - padding, margins, background image, border-width, narrow underline
IE 6 - padding, margin, border-width, narrow underline, font colors (no :hover)
IE 7 - padding, margin, vertical-align, border-width and narrow underline
Because of all the time and effort spent in producing this demonstration I would ask that you respect my copyright.
Your donations keep CSS PLAY running.
If your donation is for the use of a demo then please email me with the demo url after making your donation.