Tailwind CDN Environment Setup

Tailwind CDN Environment Setup

Tailwind CSS Project setup using a CDN (Content Delivery Network)

The Play CDN is designed for development purposes only and is not the best choice for production.

For production, you can use other options like Tailwind CLI, Using PostCSS which we will see later.

✅ Steps to follow to complete Tailwind CSS Setup Successfully

  1. Start by creating a new HTML file or open an existing one where you want to use Tailwind CSS.

  2. Add an HTML boilerplate code to that 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 CDN Setup</title>
       </head>
       <body>
         <!-- OUR HTML CODE -->
       </body>
     </html>
    
  3. Open the Tailwind CSS website (https://tailwindcss.com/) in your browser and navigate to the "Installation" section.

  4. In the installation section, you will find the option to use the CDN. Copy the CDN link provided under the "Using a CDN" heading. The link should look something like this:

     <script src="https://cdn.tailwindcss.com"></script>
    
  5. Paste the copied script tag into the <head> section of your HTML file. It should look like this

     <!DOCTYPE html>
     <html lang="en">
       <head>
         <meta charset="UTF-8" />
         <meta name="viewport" content="width=device-width, initial-scale=1.0" />
         <title>Tailwind CSS CDN Setup</title>
         <!-- TAILWIND CSS CDN -->
         <script src="https://cdn.tailwindcss.com"></script>
       </head>
       <body>
         <!-- OUR HTML CODE -->
       </body>
     </html>
    
  6. The setup process is done 😎, Now just use tailwind css classes inside the index.html

  7. Here is an example:

     <!DOCTYPE html>
     <html lang="en">
       <head>
         <meta charset="UTF-8" />
         <meta name="viewport" content="width=device-width, initial-scale=1.0" />
         <title>Tailwind CSS CDN Setup</title>
         <!-- TAILWIND CSS CDN -->
         <script src="https://cdn.tailwindcss.com"></script>
       </head>
       <body>
         <!-- OUR HTML CODE -->
         <div class="flex justify-center items-center h-screen">
           <div
             class="bg-gray-800 text-white font-bold rounded-lg border shadow-lg p-10"
           >
             Tailwind CSS CDN Setup
           </div>
         </div>
       </body>
     </html>
    

Output:

OR simply clone this GitHub repository:

https://github.com/prahladinala/simple-tailwind-cdn-starter

Follow for more

Linkedin: https://www.linkedin.com/in/prahladinala/
Github: https://github.com/prahladinala/
Instagram: https://instagram.com/prahlad.inala/
Twitter: https://twitter.com/prahladinala
Figma Community: https://www.figma.com/@prahladinala
Dribbble: https://dribbble.com/prahladinala
Behance: https://www.behance.net/prahladinala
Personal Portfolio: https://prahladinala.in
ToolMate: https://toolmate.co.in

Thank you!

Did you find this article valuable?

Support Prahlad Inala by becoming a sponsor. Any amount is appreciated!