shlogg · Early preview
Méschac Irung @meschacirung

How To Create Gradient Borders With Tailwind CSS In 5 Easy Steps

Create gradient borders with TailwindCSS using bg-gradient-to-b & rounded utilities. Calculate child container border radius using calc function for perfect rounded border.

Gradient borders are a great way to add visual interest and depth to a website. They can be used to highlight important elements, create a sense of movement, or simply make a website look more stylish.
Here are few steps to to create gradient borders with tailwindcss.

  
  
  1. Create a container

Create a div element, add rounded-3xl and p-px utilities to it. Note that you can use an other border radius utility and padding, visually, the padding will be seen as the size of the border.

<div class="rounded-3xl p-px"></div>

    
    

    
    




  
  
  2. Add a gradient background to the...