【发布时间】:2021-08-20 05:22:42
【问题描述】:
如何使用 list-disc 类来设置项目符号样式,使用 Tailwindscss?
我的 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 看起来一样:
如果没有带有 class="prose" 的容器(列表 1),项目符号完全没有样式,没有缩进,并显示浏览器默认项目符号点。
使用 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 的新手,所以我可能错过了一些“重置”默认项目符号的父元素?
可能的罪魁祸首:罪魁祸首是容器 div 中的 m-4 类,添加边距会暴露一个悬垂在屏幕外的浏览器默认项目符号,除非有任何填充或边距,在这种情况下它不再关闭-屏幕。
【问题讨论】:
-
play.tailwindcss.com/8dgGwBhAOU?file=config 你可以看到我添加了所有插件但没有添加刺激,你可以检查它是否没有添加一些额外的样式
-
太酷了,我没想到你能做到。
标签: tailwind-css tailwind-in-js