text/css
Text

Overview

text/css is the media type for Cascading Style Sheets, which define the visual presentation of HTML documents. It declaratively describes color, layout, typography, and animation.

Details

When loaded via `<link rel="stylesheet" href="/style.css">`, browsers in standards mode require the stylesheet to arrive with the text/css type (strict MIME checking). If the server sends the wrong type such as text/plain, the browser ignores the stylesheet and the page renders unstyled. Verify that .css is correctly registered in your static server's or CDN's MIME map.

CSS is a render-blocking resource and thus directly affects performance. gzip/brotli transport compression is very effective (text compresses well), and combined with caching policy (Cache-Control, ETag) it boosts repeat-visit performance. CSS can pull external resources via `@import` and `url()`, so misplaced trust can create a data-exfiltration path.

Syntax

e.g. Content-Type: text/css; charset=utf-8

File extensions

.css

Notes

Related types

Related headers