使用 Tailwindscss 如何使用 list-disc 类来设置项目符号样式?
我的 package.json 包括:
"@tailwindcss/aspect-ratio": "^0.2.0",
"@tailwindcss/forms": "^0.3.2",
"@tailwindcss/line-clamp": "^0.2.0",
"@tailwindcss/typography": "^0.4.0",
"tailwindcss": "^2.1.1",
"tailwindcss-stimulus-components": "^2.1.2",
我尝试<ul class="list-disc">
在不使用和使用 /typography 插件的情况下使用class="prose"
它们,它们看起来不同,但都不像预期的那样,Firefox 和 Chrome 看起来一样:
没有容器(清单 1)class="prose"
的项目符号完全没有样式,没有缩进,并显示浏览器默认的项目符号点。
使用class="prose"
容器(清单 2),它确实创建了一个悬挂缩进和一个较轻的项目符号点,但也有浏览器默认项目符号点(所以双项目符号符号):
这是创建该视图的 HTML:
<div class="container mx-auto m-4">
<h3>List 1</h3>
<div>
<ul class="list-disc">
<li>Bullet one long sentence, one long sentence, one long sentence, one long sentence, one long sentence, one long sentence, one long sentence, one long sentence, one long sentence, one long sentence, one long sentence, one long sentence, one long sentence, one long sentence, one long sentence, one long sentence.</li>
<li>Shorter second sentence. </li>
</ul>
</div>
<h3>List 2</h3>
<div class="prose">
<ul class="list-disc">
<li>Bullet one long sentence, one long sentence, one long sentence, one long sentence, one long sentence, one long sentence, one long sentence, one long sentence, one long sentence, one long sentence, one long sentence, one long sentence, one long sentence, one long sentence, one long sentence, one long sentence.</li>
<li>Shorter second sentence. </li>
</ul>
</div>
</div>
我对 Tailwindcss 还很陌生,所以我可能错过了一些“重置”默认项目符号的父元素?
可能的罪魁祸首:罪魁祸首是m-4
容器 div 中的类,添加边距会暴露一个在屏幕外悬挂的浏览器默认项目符号,除非有任何填充或边距,在这种情况下它不再在屏幕外。