Blur In Tailwind CSS

The purpose of this article is to introduce you to the Tailwind CSS blur class and how you can use it in your web design projects.

Tailwind CSS is a popular utility-first CSS framework that makes it easy to create beautiful and responsive web designs. With its vast array of pre-built classes, you can quickly apply styles to any element in your HTML code, including blur effects.

Tailwind Blur class can be used to create a range of visual effects on your web page, from subtle shadows to dramatic blurs.

Tailwind CSS Blur Effect



Tailwind CSS Blur Effect

Tailwind Css blur effect is a visual effect that creates a blurry, unfocused image or text.

It can be used to create a sense of depth, highlight an element, or add a subtle texture to your design.

The blur effect can also help to create a sense of motion or a dreamy quality in your designs.

Syntax

<element class="filter blur-{amount}"></element>

Tailwind CSS provides a set of classes that allow you to apply different types of blur effects to your HTML elements.

These classes allow you to create a range of blurs, from subtle shadows to heavy blurs that obscure your content.

Here are some of the most commonly used classes:

  1. blur-0 : It is equivalent to CSS blur(0), which has no blur effect.
  2. blur-sm : Similar to CSS blur(4px), which has a small blur effect.
  3. blur : This is equivalent to CSS blur(8px), which has a normal blur effect.
  4. blur-md : This class results in a medium blur effect and it corresponds to CSS blur(12px).
  5. blur-lg : Similar to CSS blur(16px) and has a large blur effect.
  6. blur-xl : Same as CSS blur(24px), which has an extra large blur effect.
  7. blur-2xl : This class is equivalent to CSS blur(40px), which has a double extra large blur effect.
  8. blur-3xl : Equivalent to CSS blur(64px), which has a triple extra large blur effect.

To use Tailwind CSS Blur class in your web design, you need to add the class to the HTML element that you want to apply the blur effect to.

Following example demonstrates the use of blur-0, blur, blur-lg and blur-2xl class:

Example: 

<!DOCTYPE html> <html> <head> <script src="https://cdn.tailwindcss.com"></script> </head> <body class="text-center mx-4 space-y-2"> <h1 class="text-gray-600 text-2xl font-semibold"> MrExamples </h1> <p class="font-semibold my-2">Blur Class in Tailwind CSS</p> <p class="text-gray-500 font-semibold text-sm my-2">Hover on the images to view the blur class applied</p> <div class="grid grid-flow-col space-x-4 text-center p-4"> <img class="rounded-lg blur-0 w-40" src="https://mrexamples.com/wp-content/uploads/2023/02/tailwind1.webp" alt="image" title="blur-0"> <img class="rounded-lg blur" src="https://mrexamples.com/wp-content/uploads/2023/02/tailwind1.webp" alt="image" title="blur"> <img class="rounded-lg blur-lg" src="https://mrexamples.com/wp-content/uploads/2023/02/tailwind1.webp" alt="image" title="blur-lg"> <img class="rounded-lg blur-2xl" src="https://mrexamples.com/wp-content/uploads/2023/02/tailwind1.webp" alt="image" title="blur-2xl"> </div> </body> </html>

This particular example sheds some light on the use of blur-0, blur, blur-lg and blur-2xl class:

Example: 

<!DOCTYPE html> <html> <head> <script src="https://cdn.tailwindcss.com"></script> </head> <body class="text-center mx-4 space-y-2"> <h1 class="text-gray-600 text-2xl font-semibold"> MrExamples </h1> <p class="font-semibold my-2">Blur Class in Tailwind CSS</p> <p class="text-gray-500 font-semibold text-sm my-2">Hover on the images to view the blur class applied</p> <div class="grid grid-flow-col space-x-4 text-center p-4"> <img class="rounded-lg blur-sm w-40" src="https://mrexamples.com/wp-content/uploads/2023/02/tailwind1.webp" alt="image" title="blur-sm"> <img class="rounded-lg blur-md" src="https://mrexamples.com/wp-content/uploads/2023/02/tailwind1.webp" alt="image" title="blur-md"> <img class="rounded-lg blur-xl" src="https://mrexamples.com/wp-content/uploads/2023/02/tailwind1.webp" alt="image" title="blur-xl"> <img class="rounded-lg blur-3xl" src="https://mrexamples.com/wp-content/uploads/2023/02/tailwind1.webp" alt="image" title="blur-3xl"> </div> </body> </html>

Conclusion

Tailwind CSS Blur effects are a powerful tool that can add depth and visual interest to your web designs. With Tailwind CSS, you can easily add different types of blur effects to your HTML elements, from subtle shadows to heavy blurs that obscure your content.

By using the different blur classes in combination with other Tailwind CSS classes, you can create visually stunning designs that are both beautiful and functional.

We value your feedback.
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0

Subscribe To Our Newsletter
Enter your email to receive a weekly round-up of our best posts. Learn more!
icon

Leave a Reply

Your email address will not be published. Required fields are marked *