如何在tailwind css中使用before和after?

Roh*_*ali 6 css tailwind-css

.card {
  position: relative;
  background-color: grey;
  display: block;
  width: 300px;
  min-height: 90px;
  cursor: pointer;
  padding: 15px;
  margin: calc(50vh - 30px) auto 0 auto;
}

.card::before {
  content: '';
  position: absolute;
  left: -5px;
  top: -5px;
  width: calc(100% - 25px);
  height: calc(100% - 10px);
  border-top: 5px solid brown;
  border-left: 5px solid brown;
}

.card::after {
  content: '';
  position: absolute;
  top: -5px;
  right: 10px;
  height: 5px;
  width: 25px;
  background-color: orange;
}
Run Code Online (Sandbox Code Playgroud)
<div class="card">
</div>
Run Code Online (Sandbox Code Playgroud)

我无法理解如何使用顺风创建相同的东西

我尝试使用 tailwind 但它不起作用,我观看 youtube 视频并搜索如何在 tailwind 中使用 after 和 before ,我是 tailwind 的新手

Dei*_*sch 6

您可以通过在 tailwind 类前面分别添加before:和来设置前后元素样式。after:

<a class="text-sky-400 after:content-['Hello\_World'] after:text-red-500" ...
Run Code Online (Sandbox Code Playgroud)

在这里阅读更多内容:
https://tailwindcss.com/docs/content
https://tailwindcss.com/docs/hover-focus-and-other-states#before-and-after