css first-letter for link

若如初见. 提交于 2019-12-01 15:28:20

问题


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;
}

回答1:


How about this http://jsfiddle.net/raynesax/8W7FF/8/




回答2:


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/




回答3:


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



来源:https://stackoverflow.com/questions/7984179/css-first-letter-for-link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!