Mobile Friendly Website


Doing it with style

CSS DEMOS:first-letter pseudo-element BUGS!!

Date : 9th January 2007

For all modern browsers

This demo is too wide for your mobile screen.
Please view on a tablet or PC.


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.

  • font properties
  • color properties 
  • background properties
  • margin properties
  • padding properties
  • border properties
  • text-decoration
  • vertical-align (only if 'float' is 'none')
  • text-transform
  • line-height
  • float
  • clear

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 screenshot

Opera - as I would expect

Safari screenshot

Safari - underline narrow

Mozilla screenshot

Mozilla - negative margins

Netscape screenshot

Netscape - negative margins

Firfox linux screenshot

Firefox linux - padding and height


Firefox screenshot

Firefox - padding, margin, height, background image and underline


IE5.01 screenshot

IE 5.01 - no styling

IE5.5 screenshot

IE 5.5 - padding, margins, background image, border-width, narrow underline

IE6 screenshot

IE 6 - padding, margin, border-width, narrow underline, font colors (no :hover)

Opera screenshot

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.

  1. If you are using this on a personal web site then please retain the copyright comment in the stylesheet.
    A support donation is now required for this demonstration.
  2. If you are using this on a commercial web site, or as a paying job for a client, then please email me asking for permission - stu{at} and again a support donation is required.
  3. If you are having problems integrating any of my demonstrations into your website then I now offer a service to fault find and correct any errors that you may have introduced. Please email me for more information.


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.


Facebook Twitter rss feed Facebook Fan Page