英文:
How to create the curve/ or a bend in a line with tailwindCss
问题
如何使用Tailwind CSS类创建线条弯曲,如您所看到的图片中,在绿色圆点下方有一条线?明确不使用CSS样式表?还是创建一个SVG并简单地使用它更好?
这是我的当前代码,任何支持将非常有帮助。
<div className="flex items-center justify-between gap-x-6 py-2.5 px-2.5 sm:pr-3.5 lg:pl-3 hover:bg-gray-100 border-l-4 hover:border-green-400 cursor-pointer rounded-sm">
<a href="#">
{/* <strong className="font-semibold"> hhh</strong> */}
<div className="flex justify-between gap-x-3">
{/* circle */}
<div className="flex h-5 w-5 rounded-full bg-green-200 items-center justify-center">
<svg
viewBox="0 0 2 2"
className="inline h-2 w-2 fill-current rounded-full text-green-500"
aria-hidden="true"
>
<circle cx={1} cy={1} r={3} />
</svg>
</div>
<p className="text-black text-md font-medium items-center justify-center">
mdsvx in sveltekit
</p>
</div>
{/* <span aria-hidden="true">→</span> */}
</a>
<div className="-m-3 flex gap-3 p-3 focus-visible:outline-offset-[-4px]">
<div className="flex-none leading-none tracking-normal text-sm font-normal text-gray-600 border border-gray-400 bg-transparent px-3 py-2 rounded-full">
#mdsvx
</div>
<div className="flex-none leading-none text-sm tracking-normal font-normal text-gray-600 border border-gray-400 bg-transparent px-3 py-2 rounded-full">
#svelte-kit
</div>
{/* <XMarkIcon className="h-5 w-5 text-black" aria-hidden="true" /> */}
</div>
</div>
希望这对您有所帮助。
英文:
How could I create the bend in a line with Tailwind CSS classes, as you can see I the picture there's a line under the green circle/dot. explicitly not using CSS stylesheet? or is it better to create an svg and simply use it?
This is my current code now, Any support would be really helpful.
<div className="flex items-center justify-between gap-x-6 py-2.5 px-2.5 sm:pr-3.5 lg:pl-3 hover:bg-gray-100 border-l-4 hover:border-green-400 cursor-pointer rounded-sm">
<a href="#">
{/* <strong className="font-semibold"> hhh</strong> */}
<div className="flex justify-between gap-x-3">
{/* circle */}
<div className="flex h-5 w-5 rounded-full bg-green-200 items-center justify-center">
<svg
viewBox="0 0 2 2"
className="inline h-2 w-2 fill-current rounded-full text-green-500"
aria-hidden="true"
>
<circle cx={1} cy={1} r={3} />
</svg>
</div>
<p className="text-black text-md font-medium items-center justify-center">
mdsvx in sveltekit&nbsp;
</p>
</div>
{/* <span aria-hidden="true">&rarr;</span> */}
</a>
<div className="-m-3 flex gap-3 p-3 focus-visible:outline-offset-[-4px]">
<div className="flex-none leading-none tracking-normal text-sm font-normal text-gray-600 border border-gray-400 bg-transparent px-3 py-2 rounded-full">
#mdsvx
</div>
<div className="flex-none leading-none text-sm tracking-normal font-normal text-gray-600 border border-gray-400 bg-transparent px-3 py-2 rounded-full">
#svelte-kit
</div>
{/* <XMarkIcon className="h-5 w-5 text-black" aria-hidden="true" /> */}
</div>
</div>
</details>
# 答案1
**得分**: 3
如何使用一个带有左边框和底部边框的 div,并将底部左角设置为圆角?
在 tailwind 中,类似于以下内容:https://play.tailwindcss.com/W8XLs2pqB1。
```html
<div class="h-7 w-4 rounded-bl-lg border-l-2 border-b-2"></div>
将所有内容放在一起,可能会看起来像这样:https://play.tailwindcss.com/cD7U8CZwZJ。
<div class="p-4">
<div>
<div class="flex items-center gap-2">
<div class="h-5 w-5 rounded-full bg-gray-200"></div>
<div class="text-sm">mdsvx in svelte kit</div>
</div>
<!-- 这是带有弧线的元素。调整高度以调整标题之间的间距。 -->
<div class="-mb-3 ml-2.5 mt-1.5 h-7 w-4 rounded-bl-lg border-l-2 border-b-2"></div>
</div>
<ul class="ml-8 space-y-2">
<li class="flex items-center gap-2">
<div class="h-5 w-5 rounded bg-gray-200"></div>
<span class="text-sm">Item</span>
</li>
<li class="flex items-center gap-2">
<div class="h-5 w-5 rounded bg-gray-200"></div>
<span class="text-sm">Item</span>
</li>
<li class="flex items-center gap-2">
<div class="h-5 w-5 rounded bg-gray-200"></div>
<span class="text-sm">Item</span>
</li>
</ul>
</div>
英文:
How about using a div with a border left and bottom and applying a border radius to the bottom left corner?
In tailwind, something like this https://play.tailwindcss.com/W8XLs2pqB1.
<div class="h-7 w-4 rounded-bl-lg border-l-2 border-b-2"></div>
Putting everything together, it could look like this https://play.tailwindcss.com/cD7U8CZwZJ.
<div class="p-4">
<div>
<div class="flex items-center gap-2">
<div class="h-5 w-5 rounded-full bg-gray-200"></div>
<div class="text-sm">mdsvx in svelte kit</div>
</div>
<!-- This is the element with a curved line. Adjust the height to adjust space between title. -->
<div class="-mb-3 ml-2.5 mt-1.5 h-7 w-4 rounded-bl-lg border-l-2 border-b-2"></div>
</div>
<ul class="ml-8 space-y-2">
<li class="flex items-center gap-2">
<div class="h-5 w-5 rounded bg-gray-200"></div>
<span class="text-sm">Item</span>
</li>
<li class="flex items-center gap-2">
<div class="h-5 w-5 rounded bg-gray-200"></div>
<span class="text-sm">Item</span>
</li>
<li class="flex items-center gap-2">
<div class="h-5 w-5 rounded bg-gray-200"></div>
<span class="text-sm">Item</span>
</li>
</ul>
</div>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论