# no-css-tags

Rule `nextjs/no-css-tags`. Prevent manual stylesheet tags.

- Source: nextjs
- Technologies: Next.js, React
- Kind: correctness
- Needs type information: no
- Autofix: no
- Reach: 99.7M weekly downloads of presets that enable it
- Trend: +49.8% last quarter
- Rank: #164 by reach, #831 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `@next/next/no-css-tags` | yes | no | package `@next/eslint-plugin-next` | [docs](https://nextjs.org/docs/messages/no-css-tags) |
| Oxlint | `nextjs/no-css-tags` | no | no | plugin `nextjs`, category correctness | [docs](https://oxc.rs/docs/guide/usage/linter/rules/nextjs/no-css-tags.html) |

## Code examples

### Incorrect: the rule reports this

```jsx
// Manually including local CSS file
<link href="/_next/static/css/styles.css" rel="stylesheet" />

// In pages/_document.js
<Head>
  <link href="css/my-styles.css" rel="stylesheet" />
</Head>
```

### Correct: the rule accepts this

```jsx
// Importing CSS file directly
import '../styles/global.css'

// Using CSS Modules
import styles from './Button.module.css'

// Using external stylesheets (allowed)
<link
  href="https://fonts.googleapis.com/css?family=Open+Sans"
  rel="stylesheet"
/>

// Using styled-jsx
<style jsx>{`
  .button { color: blue; }
`}</style>
```

Examples from the Oxlint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import next from "@next/eslint-plugin-next";

export default [
  {
    plugins: { "@next/next": next },
    rules: {
      "@next/next/no-css-tags": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "nextjs"
  ],
  "rules": {
    "nextjs/no-css-tags": "error"
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Next.js recommended](https://lintradar.dev/presets/next-recommended.md) | ESLint | `@next/eslint-plugin-next` | 22 | 52.9M | +50.7% |
| [Next.js Core Web Vitals](https://lintradar.dev/presets/next-core-web-vitals.md) | ESLint | `eslint-config-next` | 62 | 46.8M | +48.8% |

## Related rules

- [nextjs/no-assign-module-variable](https://lintradar.dev/rules/nextjs/no-assign-module-variable.md): Prevent assignment to the `module` variable.
- [nextjs/no-duplicate-head](https://lintradar.dev/rules/nextjs/no-duplicate-head.md): Prevent duplicate usage of `<Head>` in `pages/_document.js`.
- [nextjs/no-before-interactive-script-outside-document](https://lintradar.dev/rules/nextjs/no-before-interactive-script-outside-document.md): Prevent usage of `next/script`'s `beforeInteractive` strategy outside of `pages/_document.js`.
- [nextjs/no-html-link-for-pages](https://lintradar.dev/rules/nextjs/no-html-link-for-pages.md): Prevent usage of `<a>` elements to navigate to internal Next.js pages.
- [nextjs/no-async-client-component](https://lintradar.dev/rules/nextjs/no-async-client-component.md): Prevent Client Components from being async functions.
- [nextjs/no-page-custom-font](https://lintradar.dev/rules/nextjs/no-page-custom-font.md): Prevent page-only custom fonts.

---

Web page: https://lintradar.dev/rules/nextjs/no-css-tags. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
