我现在正在学习 CSS 基础知识,我在测试页面上发现了一些奇怪的东西。我正在写下使用::first-letter
and ::first-line
出于习惯,我全选了。由于某种原因,当选择第一个单词 my::selection
缺乏个性化。更奇怪的是,这只是一封信。一瞬间我想这可能是因为我将字体粗细设置为粗体,但其他粗体字母效果很好。
::selection{
background-color: #8ebacc;
color: black;
}
#first::first-letter{
font-size: 30px;
color: black;
font-weight: bold;
}
#first::first-line{
font-variant: small-caps;
font-size: 20px;
}
<p id="first">Here I wrote a lot of text. This first line is very fancy, and even fancier is the first letter. This is to give some emphasis to everything there, to establish that that is indeed the first line of this paragraph. </p>
这是怎么回事?我该如何修复它?
Using ::first-letter
with ::selection
不能在 Chrome 中工作。它是known bug
它已经由 chrome dev 提出,但尚未修复。
如果你可以使用firefox
你可以考虑使用::mox-selection
这在 Mozilla Firefox 中应该可以正常工作。
您可以关注动态并更新:https://bugs.chromium.org/p/chromium/issues/detail?id=17528 https://bugs.chromium.org/p/chromium/issues/detail?id=17528
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)