:首字母选择器不适用于链接 [英] :first-letter selector doesn't work for link

查看:67
本文介绍了:首字母选择器不适用于链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

:first-letter伪元素选择器可完美地用于<p>元素,但不适用于链接.例如,这无效:

The :first-letter pseudo-element selector works perfectly for a <p> element but not for links. This, for instance, has no effect:

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

为什么?如何使<a>元素的首字母样式不同

Why? How can I make the first-letter style different for an <a> element

推荐答案

根据

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

奇怪的是,*:first-letter使第一个字母转换为Chrome 14和Firefox 3.6.23.小提琴: http://jsfiddle.net/8W7FF/3/

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

这篇关于:首字母选择器不适用于链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆