2

I've recently installed Tailwind for my Vue project. It took some time to get it work but finally, it worked, even with code completion in VS Code.

The problem I am facing right now is that I cannot use the breakpoints anywhere in my project.

<div class="container mx-auto">
    <div class="card w-full sm:w-full md:w-1/2 lg:w-1/3 xl:w-1/3">
        // Content
    </div>
</div>

Watch a gif of it.

What I want to achieve is to have the div be 1/3 when on desktop, full width on mobile. What I am getting is full width everywhere. I can't seem to find anything else like this on the internet either.

I'd like to mention that I am using VueJS, if that's of any help. Any ideas?

Thanks in advance.

1 Answer 1

2

Eventually found the solution after a break and finding a Vue project that uses Tailwind. I needed to install postcss-preset-env and add it to postcss.config.js.

npm install postcss-preset-env --save-dev

postcss.config.js

module.exports = {
  plugins: [
    require('postcss-preset-env')({ stage: 0 }),
    require('tailwindcss')('tailwind.js'),
    require('autoprefixer')
  ]
}
Sign up to request clarification or add additional context in comments.

1 Comment

I had an issue with breakpoints not working for container css class only in version 1.4.6. Just updating to newer version of tailwindcss helped.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.