@
์ ํจ๊ป ์ฌ์ฉ๋๋ ๋ช
๋ น์ด๋ก, ์ง์๋ฌธ๋ฅผ ์ฌ์ฉํ๋ฉด CSS๋ฅผ ์ข ๋ ๊ฐ๊ฒฐํ๊ณ ์ ์ฐํ๊ฒ ์์ฑํ ์ ์๋ค.
๊ธฐ์กด ์ ํธ๋ฆฌํฐ ํด๋์ค๋ฅผ ์ฌ์ฉํ์ฌ ์ปค์คํ
์คํ์ผ ๊ตฌ๋ฌธ์ ์ถ๊ฐํ ๋ ์ฌ์ฉ๋๋ค.
.custom {
@apply relative mb-4 after:left-0 after:top-0 after:absolute
last:text-purple-300 first:text-orange-400 after:bg-slate-500
after:w-full after:h-full after:z-0
}
<!-- Before -->
<ul >
<li class="relative mb-4 after:left-0 after:top-0 after:absolute last:text-purple-300 first:text-orange-400 after:bg-slate-500 after:w-full after:h-full after:z-0"><span class="z-10 block">first</span></li>
<li class="relative mb-4 after:left-0 after:top-0 after:absolute last:text-purple-300 first:text-orange-400 after:bg-slate-500 after:w-full after:h-full"><span class="z-10 block">second</span></li>
<li class="relative mb-4 after:left-0 after:top-0 after:absolute last:text-purple-300 first:text-orange-400 after:bg-slate-500 after:w-full after:h-full"><span class="z-10 block">third</span></li>
<li class="relative mb-4 after:left-0 after:top-0 after:absolute last:text-purple-300 first:text-orange-400 after:bg-slate-500 after:w-full after:h-full"><span class="z-10 block">fourth</span></li>
<li class="relative mb-4 after:left-0 after:top-0 after:absolute last:text-purple-300 first:text-orange-400 after:bg-slate-500 after:w-full after:h-full"><span class="z-10 block">fifth</span></li>
</ul>
<!-- After -->
<ul >
<li class="custom"><span class="z-10 block">first</span></li>
<li class="custom">second</span></li>
<li class="custom"><span class="z-10 block">third</span></li>
<li class="custom"><span class="z-10 block">fourth</span></li>
<li class="custom"><span class="z-10 block">fifth</span></li>
</ul>
์ปค์คํ
์คํ์ผ ๊ตฌ๋ฌธ์ด ์ด๋ ๋ ์ด์ด(base, components, utilitis)์ ์ํ๋์ง ๊ตฌ๋ถํ๋ ์ง์๋ฌธ
์ถ๊ฐํ ์คํ์ผ์ ์ฒด๊ณ์ ์ผ๋ก ๊ด๋ฆฌํ๊ธฐ ์ํด ์ฉ๋์ ๋ง๋ ๋ ์ด์ด๋ฅผ ์ง์ ํ์ฌ ์ฝ๋์ ๊ฐ๋
์ฑ๊ณผ ์ ์ง๋ณด์์ฑ์ ๋ํ๋ค.
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
h1 {
@apply text-[32px] text-blue-500;
}
}
@layer components {
.btn {
@apply rounded-md hover:bg-cyan-800 transition-all ease-out bg-slate-600
text-red-700 px-[6px];
}
}
@layer utilities {
.rotate-15deg {
transform: rotate(15deg);
}
}