css first-letter for link

2019-02-22 05:55发布

First letter pseudo class works perfect for p element but not for anchor(links). Why? How to make the first-letter style different for <a> element

a:first-letter
{
font-size:200%;
text-transform:uppercase;
color:#8A2BE2;
}

3条回答
你好瞎i
2楼-- · 2019-02-22 06:41

If JavaScript is an option it might be worth looking at: http://letteringjs.com (which should be fairly cross-browser compatible)

查看更多
beautiful°
3楼-- · 2019-02-22 06:44
SAY GOODBYE
4楼-- · 2019-02-22 06:47

According to the W3 spec, the :first-letter pseudo-element only work for a block element, which a is not.

Oddly, *:first-letter caused the first letter to transform, at Chrome 14 and Firefox 3.6.23. Fiddle: http://jsfiddle.net/8W7FF/3/

查看更多
登录 后发表回答