Juan FoccoDec 22, 2022
Tags
When developing a product, it is crucial to analyze which framework is better, depending on the time we have and the kind of project we need to build. Tailwind and Bootstrap have their own pros and cons and in this post, we hope we can help you choose the best fit for your project.
If we want to talk about Tailwind we need to know that it is a utility-first CSS framework that doesn’t include predefined components. And here is the first difference we can find compared to other CSS frameworks, like Bootstrap.
Tailwind CSS works on a minor grade and offers a set of CSS support classes to create custom designs with the liberty to choose how to do it.
The truth is that Tailwind is a helpful framework, and we have already talked about its advantages. But I have to be honest; from my first-hand experience, there are two main disadvantages.
First, I’d say that its weakest part is the installation and initial setup process. When you start using Tailwind you need to follow a series of complicated steps that will take some time.
And the other not-that-great part about Tailwind is that it takes some time to get used to the framework and learn the names of all the classes to become more productive and hasten the process.
I’d like to compare Tailwind and Bootstrap to LEGO pieces. Tailwind provides all the separate pieces so you can design from scratch. Bootstrap provides a set of assembled parts ready to be used, which is faster but harder to change.
Defining which is better will depend on the kind of project you are working on and what needs to be done.
For example, suppose you need a handy prototype to present an idea to a client. In that case, Bootstrap will be the best choice as it provides pre-styled components (like notifications, form elements that can be lined up, friendly buttons, table layouts, navigation bars, cards, a grid, crisp typography, and more), that are already there and can be used to build a website easily and fast.
But if you have a long-term project that needs another type of design and to be customized, Tailwind would be the best choice due to its utility classes that after getting used to work with them, can help accelerate the development process even more than by using vanilla CSS.
Example: Building a notification popup.
With Tailwind:
<div class="max-w-sm mx-auto flex p-6 bg-white rounded-1g shadow-xl">
<div class="flex-shrink-0">
<img class="h-12 w-12" src="https: //images-na.ssl-images-amazon.com/ images/I/AlIA1ZulCoL.prg" alt="ChitChat Logo">
</div>
<div class="ml-6 pt-1">
<h4 class-"text-xl text-gray-900 leading-tight font-bold">Create Thrive</h4>
<p class="text-base text-gray-600 leading-normal">You have a new message!</p></div></div>
<link href="https: //unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
Without Tailwind:
<div class="chat-notification">
<div class="chat-notification-logo-wrapper">
<img class="chat-notification-logo" src="https://images-na.ssl-images-amazon.com/images/I/AlIA1ZulCoL.png" alt="ChitChat Logo">
</div>
<div class="chat-notification-content">
<h4 class="chat-notification-title">Create Thrive</h4>
<p class="chat-notification-message">*You have a new message!</p>
</div>
</div>
*{
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
padding:0px;
margin:0px;
}
body {
background-color: #edf2f7;
margin: 8px;
}
.chat-notification {
display:flex;
max-width: 24rem;
margin:0 auto;
padding: 1.5rem;
border-radius: 0.5rem;
background-color:#fff;
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.chat-notification-logo-wrapper {
display: flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
}
.chat-notification-logo {
height: 3rem;
width: 3rem;
}
.chat-notification-content {
margin-left: 1.5rem;
}
.chat-notification-title {
color: #1a2020;
font-size: 1.25rem;
line-height: 1.25;
}
.chat-notification-message {
color: #718096;
font-size: 1rem;
line-height: 1.5;
}
Tailwind is not the best choice for all projects, and that’s fine. You must consider different elements such as time, flexibility, and knowledge to decide which tool is best for your project.
But if for example, you choose Bootstrap and you need to make too many changes, then you might need to turn to vanilla CSS or to Tailwind’s utility classes.
In my personal experience using Tailwind, once you are acquainted with it and follow the classes, the project development takes less time and it’s easy to add, modify or remove any style.