DEV Community

suman_-
suman_-

Posted on

Css vs Tailwind

What is the main difference between CSS and Tailwind CSS?

When I started learning CSS, I used to wonder how hard it would be to build a full website. In my first project, I used pure CSS and ended up writing around 600 lines of code just to style the frontend. It was a good learning experience, but quite time-consuming.

But now that I’ve learned Tailwind CSS, I realize how easy and efficient it can be to build websites.

🔍 Example:

Let’s say you want to create a box and give it a background color.

  • In traditional CSS:

    • You have to create a separate CSS file (or use a <style> tag or inline styles, which is not clean).
    • Then you write something like:
    <div class="box"></div>
    
```css
.box {
  background-color: blue;
}
```
Enter fullscreen mode Exit fullscreen mode
  • In Tailwind CSS:

    • You can do it directly in the HTML:
    <div class="bg-blue-500"></div>
    

You don’t need a separate CSS file — just include the Tailwind CSS CDN or set it up in your project, and you’re good to go.

Top comments (0)