我正在尝试在
元素中创建大首字母,这些元素应该从第二行开始并覆盖两行,但在 firefox 中第一个字母的位置不符合我的预期(在其他任何地方都有效,即使在 IE 中,只有 FF 会出现问题...)
有什么想法可以让它从同一水平开始吗?
最佳答案
这对我有用,尽管它不是很优雅:
So to get a cross browser drop cap effect using
:first-letter
pseudo-element that vertically aligns, you need to applyfloat: left
, then find the height of the typeface cap height, reduce the line-height to that, adjust margin-top so it aligns correctly in Firefox and in Opera or a WebKit browser, and then using conditional comments for an IE only stylesheet remove margin-top and change line-height to correctly vertically align the type.
p::first-letter {
float: left;
font-family: Georgia, serif;
font-size: 75px;
line-height: 60px;
padding: 3px;
}
http://nickcowie.com/2009/drop-caps-first-letter-and-firefox/
关于css - 缩写 - CSS :first-letter over two lines,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10775189/