CSS列表标记不与文本内联
我玩了 :: Marker
,所有主要浏览器都支持。
更改字体尺寸时,我注意到标记 /子弹与文本没有嵌入式。使用内联,我的意思是,子弹的顶部应该与文本的顶部内联。
我尝试在没有运气的情况下重置桨和边距。
有没有办法解决此问题而不会使子弹更小,并且仍然使用 :: Marker
?
ul {
margin: 0;
padding: 0;
margin-left: 4rem;
}
li::marker {
margin: 0;
padding: 0;
font-size: 5rem;
}
<ul>
<li>Chocolate bar chocolate bar sweet roll caramels oat cake marzipan chocolate apple pie shortbread. Halvah donut jelly beans pie liquorice brownie gummi bears marzipan cotton candy. Cake pudding bonbon liquorice sweet roll.</li>
<li>Chocolate bar chocolate bar sweet roll caramels oat cake marzipan chocolate apple pie shortbread. Halvah donut jelly beans pie liquorice brownie gummi bears marzipan cotton candy. Cake pudding bonbon liquorice sweet roll.</li>
</ul>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,目前,无法指定
:: Marker
'spadding
或Margin
。根据规格,color
text-combine intright
,unicode-bidi
and code>方向方向content
至少现在不支持其他任何东西。您不能使用
保证金
,填充
,position
,top/left/left /...
。如果您需要对标记的更多控制权,请使用
list-style-type:none
,并且使用:之前(适用于大多数用例),或者简单地将每个内容的内容列为每个内容&lt; li&gt;
带有&lt; div class =“ marker”&gt;&lt;/div&gt;
,它为您提供完整的控制:示例:示例:
Unfortunately, at the moment, there is no way to specify
::marker
'spadding
ormargin
. According to the spec, the allowable properties are:white-space
,color
text-combine-upright
,unicode-bidi
anddirection
content
Anything else is not supported, at least for now. You can't use
margin
,padding
,position
,top/left/...
.If you need more control over your markers, use
list-style-type: none
and either use:before
(works for most use cases) or simply prefix the contents of each<li>
with a<div class="marker"></div>
, which gives you full control:Example: