The Wayback Machine - https://web.archive.org/web/20241118070519/https://www.geeksforgeeks.org/how-to-use-both-tailwind-css-and-bootstrap-4-at-the-same-time/
Open In App

How to use both Tailwind CSS and Bootstrap 4 at the same time ?

Last Updated : 24 Dec, 2021
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

In this article, we will know how to use Bootstrap with Tailwind CSS, at a moment, in the same code. We can use both the CSS frameworks together but it is not recommended. Because few classes will contradict with each other like “container”, “clearfix”, etc. As we know that Bootstrap is a known CSS framework. Although the Tailwind CSS framework can also be used parallelly in comparison to Bootstrap. Tailwind CSS is basically a utility-first CSS framework that facilitates rapidly building custom user interfaces. So, in the development field, it is more familiar with the Tailwind rather than Bootstrap. There are significant differences in the Tailwind CSS vs Bootstrap.

Suppose there is a pre-build website where the old developers have used Bootstrap and the new developers want to use Tailwind. In that case, the new developer has to be careful with the used Bootstrap classes, where the classes should not contradict each other. We will be using the below CDN links in the code example in order to use the various applicable Bootstrap & Tailwind CSS classes, & utilize them on a single page.

Bootstrap CDN Link:

<link rel=”stylesheet” href=“ https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css”> 
<script src=“ https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js”></script> 
<script src=“ https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js”></script> 
<script src=“ https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js”></script>
  

Tailwind CSS CDN Link:

<link href=“ https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css” rel=”stylesheet”>
 

Example: In this example, we will use Bootstrap for content alignment, & for text and background color, we will use Tailwind CSS. So both the frameworks will applicable.

HTML




<!DOCTYPE html>
<html>
 
<head>
    <!-- Bootstrap CDN Links -->
    <link rel="stylesheet"
          href=
    <script src=
    </script>
    <script src=
    </script>
    <script src=
    </script>
 
    <!-- Tailwind CSS CDN Links -->
    <link href=
"https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"
          rel="stylesheet">
</head>
 
<body>
   
    <!-- Bootstrap Class -->
    <div class="col">
        <div class="col-md-4">
           
            <!-- Tailwind CSS Class -->
            <p class="bg-purple-300 p-2">
                <b class="text-green-700">GeeksforGeeks</b>
                <br>This example illustrates the use of
                    Bootstrap and Tailwind side by side.
            </p>
 
        </div>
    </div>
</body>
 
</html>


 Output:



Similar Reads

What is the use of the tailwind.config.js file in Tailwind CSS ?
The tailwind.config.js file in Tailwind CSS serves as a central configuration hub for customizing the framework. It allows you to define colors, fonts, breakpoints, and more, tailoring Tailwind to fit your project's specific design and functionality requirements. Syntax:/** @type {import('tailwindcss').Config} */module.exports = { content: [], them
1 min read
How to Add Both !important & selector Strategy for Tailwind CSS Configuration ?
Tailwind CSS is a popular utility-first CSS framework that provides a set of pre-defined classes for common styles such as margins, padding, colors, and more. While Tailwind aims to provide a simple and easy-to-use solution for styling websites and applications, sometimes we need to override the default styles or provide custom styles that are not
3 min read
Which CSS framework is better Tailwind CSS or Bootstrap ?
In this article, we will see which CSS framework is better tailwind CSS or bootstrap. Both are widely used CSS frameworks for styling the front end. We will understand each one of them in detail. Both frameworks have their own pros and cons so it depends upon the type of application you are going to build and accordingly you can choose the best fra
5 min read
How to use CSS Animations with Tailwind CSS ?
Tailwind CSS classes are used to style elements and apply animations effortlessly. Utilize Tailwind's animation utility classes to add dynamic visual effects. Combine Tailwind CSS with custom CSS animations for versatile and engaging web designs. Table of Content Tailwind CSS Animation Utility ClassesCSS Animations with Tailwind CSS and JavaScriptT
3 min read
How to Align Text and Icon on the Same Line with Tailwind CSS?
TailwindCSS is a utility-first CSS framework that offers a wide range of classes to help style elements quickly and efficiently. It provides various classes to align text and icons on the same line, ensuring that both elements are visually harmonious and well-positioned. These are the following approaches: Table of Content Using FlexboxUsing inline
2 min read
Difference between bootstrap.css and bootstrap-theme.css
Bootstrap is an HTML, CSS and JS front-end-framework used for developing responsive and mobile-first projects on the web. It is the framework that comes up with predefined terms, thus giving you the ability to use these codes instead of having to create the codes from scratch. It is a collection of HTML, CSS and JS code that is designed to help bui
5 min read
How to Increase Height and Width of Date and Time Fields in Tailwind CSS?
Tailwind CSS is a utility-first CSS framework that enables developers to design web interfaces quickly. By applying pre-defined classes we can control the appearance of the HTML elements without writing custom CSS. This article will focus on adjusting the size of the date and time fields to fit the design requirements. Below are the approaches to i
2 min read
How to Create Columns with the Same Height in Tailwind CSS ?
Creating columns of equal height is a common design requirement in web development. This need arises in scenarios like displaying a grid of cards or a list of items where each column should have the same height regardless of its content. Tailwind CSS, a utility-first CSS framework, provides several ways to achieve equal height columns effortlessly.
2 min read
Tailwind CSS vs Bootstrap
Tailwind CSS was initially developed by Adam Wathan, and the first version was released back on the 1st of November, 2017. Tailwind CSS is a utility-first CSS framework for building custom user interfaces rapidly and efficiently. It is an inline styling used to achieve a sleek interface without writing code for your own CSS. Tailwind CSS offers cus
3 min read
Design a Time Duration Calculator Card in Tailwind CSS & JavaScript
In this article, we'll create a simple Time Duration Calculator application using the Tailwind CSS and JavaScript. The application allows users to add a starting date & time and an ending date & time. And user gets the difference between these two dates as a output. We'll utilize Tailwind CSS for styling to create an attractive user interfa
3 min read
RC Time Constant Calculator Card using Tailwind CSS & JavaScript
The RC Time Constant Calculator is a web application designed to calculate the time constant (τ) of a resistor-capacitor (RC) circuit. It allows users to input the resistance and capacitance values of the circuit and then calculate the time constant based on these inputs. The calculator is designed with a clean and intuitive interface using the Tai
3 min read
How to use hover, focus and active variants in Tailwind CSS ?
In this article, we will see how to use hover, focus, and active variants in Tailwind CSS. Tailwind CSS uses the Hover, Focus, and Active variants to style an element when the user mouses move over it, focuses it, or actively clicks/tapped it. These variants allow you to create interactive and dynamic user interfaces without writing custom CSS. The
4 min read
How to use motion-safe and motion-reduce in Tailwind CSS ?
Tailwind CSS is a CSS framework that helps in building rapid custom UI. It is a highly customizable, low-level CSS framework that gives you all of the building blocks that you need. In Tailwind CSS, motion-safe and motion-reduce are utility classes used for creating animations. motion-safe ensures animations play regardless of user preferences, whi
2 min read
How to use the skew and skew-y Classes in Tailwind CSS ?
In Tailwind CSS, the skew-x-[amount] and skew-y-[amount] classes are used to apply skew transformations to elements. These classes allow you to skew an element along the x-axis or y-axis, creating visually interesting effects. Syntax<div class="skew-x-12"> Skewed along the x-axis</div><div class="skew-y-[-8]"> Skewed along the y-a
1 min read
How to use Ring and Ring-offset Classes in Tailwind CSS ?
In Tailwind CSS, the ring and ring-offset classes are used to add outline-like effects around elements, allowing you to create various visual styles such as focus rings, border highlights, and more. To use the ring and ring-offset classes in Tailwind CSS, apply them to HTML elements to add visual enhancements like border rings and offsets. Use the
2 min read
How to use ::before and ::after elements in Tailwind CSS ?
In Tailwind CSS, we can use the ' :: before ' and ' :: after ' pseudo-elements by adding utility classes directly in your HTML. Simply apply the "before:" or "after:" prefix followed by the desired utility classes to style elements before or after their content. Using Utility ClassesTailwind CSS offers utility classes for seamless modification of p
1 min read
Should I use Hooks, classes, or a mix of both?
The choice between using React hooks or class components depends on several factors, and there isn't a one-size-fits-all answer. Both class components and functional components with hooks are widely used in React development. However, functional components with hooks have become more popular due to their conciseness and the additional features intr
2 min read
Storybook-tailwind. How should I add tailwind to storybook
In this article, we will guide you through the process of adding Tailwind CSS to Storybook to enhance your UI development. Storybook is an open-source UI that helps developers create reusable, organized UI components with proper documentation independently. Tailwind CSS is basically a utility-first CSS framework for building rapid custom UI. Prereq
2 min read
How to use template literals in Tailwind CSS to change classes dynamically ?
Tailwind CSS is a popular utility-first CSS framework used by many web developers to build modern and responsive user interfaces. It provides a wide range of pre-defined classes that can be used to style elements, but what if we want to dynamically change classes based on some condition or user input? This is where template literals come in handy.
6 min read
Can we use Padding Negative in Tailwind CSS ?
It is to be noted that Tailwind CSS doesn't support negative padding values, or in other words, there is no concept that exists for utilizing the padding value as negative. Note: Padding cannot be negative, so instead of using this, you can use negative margin. Instead of using this (negative padding), the negative margin can be used by specifying
2 min read
How to use @apply directive in Tailwind-CSS ?
Tailwind CSS is a popular utility-first CSS framework. It is a set of pre-defined CSS classes that can be used to quickly and easily style your HTML elements without having to write custom CSS code. The classes are organized into a set of utility classes that can be used to control the layout, spacing, typography, and other aspects of your design.
3 min read
How to use Tailwind CSS with esbuild ?
Tailwind CSS is a utility-first CSS framework for building rapid custom UI. It is a highly customizable, low-level CSS framework that gives you all of the building blocks that you need. An esbuild is a bundler for the web project that brings the build tool for performance enhancement, along with facilitating to development of an easy-to-use modern
3 min read
How to use Ant Design with Tailwind CSS in a React Project ?
The integration of Ant Design and Tailwind CSS in a React project presents challenges due to their differing styling conventions. Ant Design offers a feature-rich component library with its own class names, while Tailwind CSS provides a utility-first framework for custom designs. Combining both libraries requires a thoughtful approach to applying t
2 min read
How to use Tailwind CSS with Django ?
Tailwind CSS has gained immense popularity among developers for its utility-first approach to styling web applications. Django on the other hand is a robust and flexible web framework written in Python. Combining these two powerful tools can enhance your Django projects. In this article, we will explore how to integrate the capabilities of Tailwind
4 min read
How to use line-clamp Class for Text Truncation in Tailwind CSS ?
The line-clamp-[number] Class in Tailwind CSS is used for text truncation by limiting the number of displayed lines. This is particularly useful for creating ellipsis in multi-line text when the content exceeds a specified number of lines. Syntax<div class="line-clamp-3"> <!-- Text content --></div><div class="truncate">
1 min read
How to use Diagonal Fractions in Tailwind CSS ?
Tailwind CSS diagonal-fractions utility allows you to display numbers separated by a slash as common diagonal fractions. This activates those sets of figures where the numerator and denominator appear small and are separated by a slash. Syntax:<element class="diagonal-fractions"> Content </element>Diagonal-fractions UtilityThe diagonal-
2 min read
How to use Flexbox Utilities in Tailwind CSS ?
To use Flexbox utilities in Tailwind CSS, apply classes that control the layout and alignment of flex container and flex items. Common classes include flex, flex-row, flex-col, justify-between, items-center, and more. Syntax<div class="flex flex-row justify-between items-center"> <div class="flex-shrink-0">Logo</div> <div class
2 min read
What is use PurgeCSS in a Tailwind CSS Project ?
PurgeCSS in a Tailwind CSS project is a tool used to eliminate unused CSS styles from your final production build. It analyzes your codebase and removes any styles that are not applied in your HTML or JavaScript, resulting in a smaller and more optimized stylesheet for better performance. Steps to Configure the PurgeCSSStep 1: Install the PostCSS p
1 min read
How to use Radial Gradient in Tailwind CSS ?
A radial gradient is a graphical effect where colors transition in a circular or elliptical pattern. By default, the first color starts at the center and fades out to the edge of the element. Tailwind CSS makes it easy to implement radial gradients with its utility classes. We can use the below approaches to achieve a Radial gradient in Tailwind CS
3 min read
How to Use Custom Percentages in Padding in Tailwind CSS?
We know that Tailwind CSS provides a utility-first approach for styling web applications, which makes it easy to apply styles directly in HTML. This article guide will explain how to use custom percentages in padding within Tailwind CSS. Approach: Using Custom Utility ClassesThis approach involves custom utility classes in your CSS file and applyin
2 min read
three90RightbarBannerImg