Web BuildingBeginner

Tailwind CSS in Practice

Style web applications rapidly with Tailwind's utility-first CSS framework and design tokens.

3 hours
5 key concepts
2 in-depth sections
Official Docs

0 of 5 concepts completed (0%)

What You'll Learn

1.Core Utilities & Responsive Design

html
<!-- Responsive breakpoints: sm: md: lg: xl: 2xl: -->
<!-- Mobile-first: no prefix = mobile, prefixes = larger screens -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
  <div class="p-4 md:p-6 lg:p-8">
    <h2 class="text-lg md:text-xl lg:text-2xl font-bold">Card</h2>
    <p class="hidden md:block">Only visible on md and larger</p>
    <p class="md:hidden">Only visible on mobile</p>
  </div>

Description

```

2.Component Extraction

css
/* @layer components reusable patterns */
@layer components {
  .btn {
    @apply inline-flex items-center justify-center
           rounded-lg px-4 py-2 text-sm font-medium
           transition-colors focus:outline-none
           focus:ring-2 focus:ring-offset-2;

.btn-primary { @apply btn bg-indigo-600 text-white hover:bg-indigo-700 focus:ring-indigo-500; }

.btn-outline { @apply btn border border-gray-300 bg-transparent text-gray-700 hover:bg-gray-50; }

.card { @apply rounded-2xl border border-gray-200 bg-white p-6 shadow-sm hover:shadow-md transition-shadow; }

.input { @apply w-full rounded-lg border border-gray-300 px-3 py-2 text-sm focus:border-indigo-500 focus:outline-none focus:ring-1; } } ```

javascript
// tailwind.config.js extend design system
module.exports = {
  content: ["./src/**/*.{html,js,jsx,ts,tsx}"],
  theme: {
    extend: {
      colors: {
        brand: { 500: "#7c3aed", 600: "#6d28d9" }
      },
      fontFamily: {
        heading: ["'Space Grotesk'", "sans-serif"],
      },
    }
  },
  plugins: [require("@tailwindcss/forms"), require("@tailwindcss/typography")],
};

Code Example

<!-- Tailwind card component -->
<div class="max-w-sm rounded-2xl border border-gray-200 bg-white p-6 shadow-md hover:shadow-lg transition-shadow">
  <span class="text-xs font-semibold uppercase tracking-wider text-indigo-600">
    Category
  </span>
  <h3 class="mt-2 text-xl font-bold text-gray-900">Card Title</h3>
  <p class="mt-3 text-sm text-gray-500 leading-relaxed">
    Description text goes here with proper spacing.
  </p>
  <button class="mt-4 w-full rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 transition-colors">
    Learn More
  </button>
</div>

Pro Tips

  • 1Install the Tailwind CSS IntelliSense VS Code extension it provides autocomplete, linting, and hover previews.
  • 2Use @layer components to extract repeated utility patterns into reusable class names without losing the utility-first benefits.
  • 3The arbitrary value syntax (w-[347px], text-[#abc123]) is for one-off values. If you're using it everywhere, add it to tailwind.config.js.
  • 4Consistent class ordering: layout → sizing → spacing → typography → colors → borders → effects → interactions.

Topics Covered

Tailwind CSSUtility-FirstDesign System

Continue Learning

Explore the official documentation and deepen your knowledge with real-world practice.

Explore the Full Portfolio

This is the complete portfolio of Sufi Khan Sulaiman, a technology leader specialising in B2B commerce and digital automation. Start from the Home page for the overview, then move through two decades of career experience across FLIR Systems, Lorex Technology, and 1c Platform, and the full catalogue of project case studies spanning headless commerce migrations, AI recommendation engines, and multi-channel fulfilment systems.

The skills and certifications page maps the technical and leadership capabilities behind the work, while the articles and the knowledge base break down the thinking into actionable frameworks. For hands-on learning, the tutorials and applications sections cover practical builds from front-end fundamentals to full-stack web apps.

For consulting engagement, the expertise page outlines service offerings, the ecommerce hub covers platform architecture and automation strategy, and the ecommerce guide (PDF) is a downloadable 55-page field manual. When you are ready to talk, the contact page is the direct line.