Open In App

What is Tailwind CSS ?

Tailwind CSS is a CSS framework that helps developers in the rapid designing of the web without shifting back and forth between different pages for HTML and CSS. Tailwind CSS doesn't come with pre-designed components, rather it provides set of utility classes that can be used to style HTML elements directly.

WHAT-IS-Tailwind-CSS-copy

History

Tailwind CSS was developed by Adam Wathan, Jonathan Reinink, David Hemphill and SteveSchoger. It was first released in November 2017. and the stable release was released in 5 January 2024. It gained significant popularity since then due to its simplicity and flexibility to use.

Different Ways of Using Tailwind CSS

Using CDN

This method involves directly linking the tailwind CSS using CDN (Content Delivery Network) in our HTML file. In this approach, we don't need to install tailwind CSS via npm package.

 <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.0.3/dist/tailwind.min.css" rel="stylesheet">

Using NPM Package

This method of using tailwind CSS involves installing tailwind CSS as an npm package. There are few steps that we need to go through to set tailwind CSS up for the project.

npm install tailwindcss
npx tailwindcss init
/* styles.css */
@tailwind base;
@tailwind components;
@tailwind utilities;

Example: This example shows the use of Tailwind CSS in HTML file.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width,
                                 initial-scale=1.0">
  <title>Tailwind CSS Example</title>
  <link href=
"https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css"
        rel="stylesheet">
</head>
<body>
  <div class="p-4 bg-blue-500 text-white">Hello,
    Tailwind CSS!</div>
</body>
</html>

Output:


Screenshot-2024-03-12-121157

Output



Features of Tailwind CSS

Applications of Tailwind CSS

Advantages of Tailwind CSS

Limitations of Tailwind CSS

Article Tags :