# CSS

Next.js has built-in support for [styled-jsx](https://github.com/vercel/styled-jsx)(CSS in JS lib)

Can also import .css and .scss files

## Tailwind

<https://github.com/vercel/next.js/tree/canary/examples/with-tailwindcss>

```bash
yarn add tailwindcss postcss-preset-env postcss-flexbugs-fixes
npx tailwind init tailwind.config.js --full
```

postcss.config.js

```jsx
module.exports = {
  plugins: [
    'tailwindcss',
    'postcss-flexbugs-fixes',
    [
      'postcss-preset-env',
      {
        autoprefixer: {
          flexbox: 'no-2009'
        },
        stage: 3,
        features: {
          'custom-properties': false
        }
      }
    ]
  ]
}
```

tailwind.config.js

```jsx
module.exports = {
  purge: [
    './components/**/*.{js,ts,jsx,tsx}',     
    './pages/**/*.{js,ts,jsx,tsx}'
  ],
  //...
}
```

styles/index.css

```css
@tailwind base;
@tailwind components;

@tailwind utilities;
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://openai.gitbook.io/code-cheatsheets/react/next/css.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
