Why I use Tailwind CSS instead of Bootstrap
Tags: webdev, tailwindcss, css, bootstrap
Published: 2021-03-05 18:43:27

If you are creating a new website or with a small web development team in a short amount of time, most developers lean towards Bootstrap to help with the design. The reason for this, is ease of use, tons of documentation and plenty of "predefined css components" which is why Bootstrap is popular.

But!, when project's get bigger and more traffik comes to the site(s), concerns of page overload and performance arise. While using Bootstrap it is very unlikely one will use all of it's available framework classes, which equals to considerable amount of css overload as well as unused components.

**Tailwind to the rescue!!!** 

Tailwind is a CSS utility framework, some call it a "utility bundle" for rapid UI development, (my go to for quick development). Why? Tailwind doesn't provide a default theme or any predefined UI components, it is unlikely to get two different web pages, designed by 2 different developers and the web pages would look the same or similar, allowing the developer to have an identity/signature.

With Tailwind CSS, there is no limit to the imagination, designing is structured in a way so developer's are able to create their own ruleset to avoid css overload or repeated properties.

All utility classes can be reviewed in the [Tailwind CSS documentation](https://tailwindcss.com/docs) as well as the tailwind.config.js file, which will be located in the root of a project after [installation](https://tailwindcss.com/docs/installation#post-css-7-compatibility-build). Every available class can be configured for small and larger project's.

Example of styling a button using tailwind and Bootstrap: 
*I am using VSCode as my Text Editor*
![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/slbeqq24vuykyt0vgsqx.jpg)

Output:
*Tailwind CSS vs Bootstrap*
![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f5ph0m6usk8ua5j47vp5.jpg)

Bootstrap predefined button design is achieved. To achieve a custom look when using Bootstrap we need to write custom css. Using Tailwind CSS utility classes, it is possible to achieve any look and feel of the button without writing any css.

**WHY!?**

You will have the ability to create personal UI design, identity and branding without writing a bunch of custom CSS (you don't have to be CSS expert)

**The ease of creating Responsive websites/web apps**

Tailwind utility class behave in a responsive behaviour. This allows for effortless creation of responsive components without writing additional CSS. Tailwind provides a simple method of putting already existing utility classes into a responsive context. Using the prefix {screen size}:{class}. Look at the above example, if you want to change its color, size etc. depending on the screen size (desktop monitor, laptop or mobile smart device) we have to add the following:

*Look at line 23*
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2eqp4165hedqa0k3kw6e.jpg)

Output:

*Site being viewed on a laptop*
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ojsj6z8rdu8bli04wsux.jpg)

*Site being viewed via smart device*
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1llcq4i0q6vnp32xat1u.jpg)

Tailwind responsiveness implies that the page is going to be created for mobile screens first. Adding bg-red-500 tells the background of the element changes to red if the size of the screen is small. If the size of the screen is medium-xl than the size has to be applied"md:class lg:class axl:class " represents the color of the background change to yellow (bg-yellow-500).

These are the predefined screen size options in Tailwind:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/98lfb7tk4780t3f9wxwn.png)

*The possibilities are endless!*

**You can configure/customize Tailwind Utilities**

The biggest strengths of Tailwind is its configurability. In every Tailwind project is the tailwind.config.js file located in the root of the project (must be in the root of project/directory). It contains all the configurable utility classes and colors. This file doesn't exist unless the user generates it. If there is no config file the utility classes are the same as mentioned in the official documentation. To learn more go to [Tailwind documentation](https://tailwindcss.com/docs)

Tailwind is simple, professionally made, well documented and worth your time. It made my workflow better, faster and helped me understand CSS (also known as Vanilla CSS), made made projects uniform and reduced the amount of CSS I wrote over the course learning it. None of my projects look the same, the creator of Tailwind [(Adam Wathan)](https://adamwathan.me/) is an experienced guy in the industry and is continuously improving Tailwind. [(Adam Wathan)](https://adamwathan.me/) also wrote a book [Refactoring UI](https://refactoringui.com/book/) that I recommend you read!

***In short, Tailwind is the love of my life...***