Tailwind CSS-based design that includes custom button styles, gradient effects, and utility classes.

The code you provided appears to be a Tailwind CSS-based design that includes custom button styles, gradient effects, and utility classes. I'll break down what each part of the code is doing:

Tailwind Directives:

@tailwind base;
@tailwind components;
@tailwind utilities;
  • These are Tailwind CSS directives that import the base styles, components, and utility classes into your stylesheet. It allows you to use Tailwind's utility-first classes like text-lg, bg-gradient, h-48, etc.

Button Styles (.btn):


.btn {
    background: linear-gradient(
      92.23deg,
      #ff56f6 21.43%,
      #b936ee 50.63%,
      #3bace2 100%,
      #406aff 117.04%
    );
    box-shadow: 0px 4.42184px 107.23px rgba(255, 86, 246, 0.51);
  }

  • This section defines a custom button class .btn. It applies a linear gradient background with specific color stops, creating a smooth gradient effect from pink to blue shades.
  • The box-shadow adds a glowing effect with a soft shadow in the rgba color format (rgba(255, 86, 246, 0.51)), which matches the pink color in the gradient.

Button Hover State:


.btn:hover {
  background: linear-gradient(
    92.23deg,
    #406aff 21.43%,
    #3bace2 50.63%,
    #b936ee 100%,
    #ff56f6 117.04%
  );
}

  • This defines the hover state for the .btn class. When the user hovers over the button, the gradient colors reverse order to create a visually engaging effect.

Gradient and Active Class:


.gradient,
.active {
  background: linear-gradient(
    92.23deg,
    #406aff 21.43%,
    #3bace2 50.63%,
    #b936ee 100%,
    #ff56f6 117.04%
  );
}

  • Both .gradient and .active classes are styled with the same linear gradient as the button, which gives them a similar color effect.

    .active {
        color: #fff;
        padding: 1rem;
        border-radius: 100%;
    }

  • .active adds white text color (color: #fff), padding around the content, and a fully rounded border (border-radius: 100%), which makes it appear as a circular button or element.

Base Layer (@layer base):


    @layer base {
        body {
            @apply font-secondary text-lg leading-8 text-white;
        }

        .h2 {
            @apply font-primary text-[32px] mb-6 tracking-[10%] uppercase;
        }

        .h3 {
            @apply font-primary font-semibold text-[26px] mb-6 leading-[46px];
        }

        .btn {
            @apply rounded-full font-primary text-white font-medium;
        }

        .btn-sm {
            @apply h-[48px] px-6 text-sm;
        }

        .btn-lg {
            @apply h-[56px] px-10 text-base;
        }

        .btn-link {
            @apply text-base;
        }

        .text-gradient {
            @apply bg-gradient-to-r text-transparent bg-clip-text from-[#42A6E3] to-[#FF56F6] font-bold font-primary hover:from-[#FF56F6] hover:to-[#42A6E3];
        }

        .section {
            @apply py-8 lg:py-24 lg:h-screen flex items-center;
        }
    }

  • This section leverages the @apply directive of Tailwind CSS to apply utility classes directly in custom CSS.
  • Body styling: Sets the default font (font-secondary), size (text-lg), line height (leading-8), and color (text-white).
  • Heading styles: Defines the styles for .h2 and .h3 with specific font properties, size, margin, and text tracking.
  • Button variants: It creates variants like .btn-sm, .btn-lg, and .btn-link, which change the size and font of the buttons, providing flexibility for different contexts.
  • Text Gradient: The .text-gradient class applies a gradient text effect with bg-clip-text, making the text color transition from one gradient to another. It also defines hover behavior.
  • Section styling: The .section class defines padding (py-8 and lg:py-24) and flexbox settings to vertically center the content.

Summary:

This code provides a visually engaging design using Tailwind CSS utilities and custom gradient styles. You have a flexible button component that features gradient backgrounds and glowing effects, as well as utility classes that enable responsive design, typography, and spacing.

To make use of this code:

  1. Ensure that Tailwind CSS is properly set up in your project.
  2. You can then use these custom classes in your HTML to style elements like buttons, sections, headings, and more.

Let me know if you'd like further clarification or help with implementing this in your project!

Comments

Popular posts from this blog

Lets build a Markdown blog using Next.js, Shadcn, Tailwind, Pieces, Remark & Rehype 🔥

React Portflio Website Basic to Advance

Todo List app using html,js and tailwind.css with features login,logout,storing the data in localstorage addtodos,deletetodos and updating todos,toastify library and many more