views:

58

answers:

5

Hi.

Is it possible to change the size of a specific character using CSS?

For example, in a paragraph I am using font-face: Arial; font-size: 12pt;. I would like that only the letter "a" would appear in size 10.

Is there a way to do that?

Thanks.

A: 

No. You can only target elements (such as a span that contains a single letter) and pseudo-elements (such as :first-letter).

David Dorward
+8  A: 

No. Except for :first-letter and other pseudo-classes, you can't target single characters using CSS. You'd need to wrap the character into an element (e.g. a <span>) to specify a style for it.

You can work around this using Javascript - there are jQuery based solutions for this here on SO. But it's kludgy.

Pekka
+4  A: 

I don't believe you can, consider using a text editor to do a find/replace 'a' with <span class='a-xxx'>a</span> and then you can use css to do .a-xxx { font-size: 10px; }

sjobe
A: 

You can't do this in a cross-browser-consistent and simple way without javascript. I recommend 'captify' for jquery.

toninoj
A: 

Also for accessibility and compatibility and all that it is best not to define specific fonts (try font-family) and sizes in terms of large, larger then use % ontop of that, and define them all as custom span/div styles

e.g

bigletter (font-size:150%);

princessmarisa
thank you all for the answers. have been very helpful. i will try searching and replacing on my site and if that doesnt go, perhaps JQuery.
Crippletoe