Tailwind Custom Base CSS For Headers, Link And Inline Elements Container

Jan 6, 2023


  • Setup h1, h2 and h3 text size
  • Apply a href link color
  • no-link utility for normal text color, no underline, but underline on hover
  • button-link for normal text color, no underline
  • t-inline-container: horizontal list of elements with a gap between them
@tailwind base;@tailwind components;@tailwind utilities;@layer base {  h1 {    @apply text-4xl;  }  h2 {    @apply text-3xl;  }  h3 {    @apply text-2xl;  }  a {    @apply t-link;  }  a.no-link {    @apply text-inherit no-underline hover:underline;  }  a.button-link {    @apply text-inherit no-underline hover:no-underline;  }}@layer components {  .t-link {    @apply underline text-blue-600 hover:text-blue-800  }  .t-inline-container {    @apply inline-flex flex-wrap gap-x-2 gap-y-1  }}

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.