CSS MIME Type
text/css means, how CSS files are identified and served, which applications open them, and how Poly supports them. MIME type details for text/css
In active use| MIME type | text/css |
|---|---|
| Extensions | .css |
| First standardized | 1996 |
| Created by | Håkon Wium Lie, Bert Bos, and the W3C |
| Browser support | Chrome, Edge, Firefox, Opera, Safari |
| Example applications | Visual Studio Code, WebStorm |
| Poly support | Yes. Poly recognizes `.css` files and makes their readable stylesheet source available throughout the app. |
| Indexed by Poly | Yes. Poly indexes CSS source for full-text and semantic search. It does not render a page to index the stylesheet's visual effect. |
| Preview in Poly | Yes. CSS opens in Poly's source editor with syntax highlighting, word wrap, and in-file search. |
| Poly agent | Yes. The Poly agent can read and reason about CSS source. It does not automatically load the HTML, fonts, images, or imported stylesheets that give the rules their full context. |
What does text/css mean?
The registered text/css media type identifies a Cascading Style Sheets stylesheet. CSS describes how a structured document, usually HTML or SVG, should be presented on a screen, on paper, or in another medium. A standalone stylesheet is plain text containing selectors, at-rules, declarations, comments, and references to other resources.123
The registered extension is .css, and the format has no magic number.2 That matters because a file signature cannot reliably distinguish CSS from another text file. Software normally relies on the filename, an HTTP Content-Type header, or other surrounding metadata.
text/css identifies the stylesheet language, not a complete visual document. The same CSS can produce different results when it is applied to different markup, fonts, viewport sizes, user preferences, or browser capabilities.How CSS and text/css became standards
Håkon Wium Lie began work on CSS at CERN in October 1994. Bert Bos joined the project in 1995, and the W3C published CSS Level 1 as a Recommendation on December 17, 1996.4 CSS files had already been using text/css since October 1995. RFC 2318 formally registered the media type in March 1998.2
Modern CSS is no longer defined by one monolithic specification. The CSS Working Group maintains a family of modules for syntax, the cascade, color, fonts, layout, animation, and other areas. Those modules advance independently, so labels such as "CSS3" or "CSS4" are poor descriptions of a file's actual feature set.5
This modular design does not create different MIME types. A stylesheet using Grid, custom properties, container queries, or a newer color function is still text/css. Compatibility depends on the individual features used, not on a version encoded in the media type.
How to open and inspect a .css file
Because CSS is text, any plain-text editor can open it. A CSS-aware editor is more useful because it can highlight syntax, complete properties and values, navigate selectors, and flag invalid declarations. Visual Studio Code has built-in support for .css editing, while WebStorm provides CSS completion, formatting, refactoring, and applied-style inspection.67
A browser can also display the source of a CSS URL, but the best way to understand what the rules do is to load the associated page and inspect it with developer tools. Chrome DevTools, for example, shows matched and overridden declarations, computed values, cascade layers, and links back to stylesheet sources.8
Serving CSS with the correct MIME type
An external stylesheet should be returned with an HTTP header such as:
Content-Type: text/css; charset=utf-8
The .css suffix is only a filename convention. Web browsers use the response's media type when deciding how to process a resource, and most will ignore a stylesheet served as text/plain or application/octet-stream.9
For HTML, link the external resource normally:
<link rel="stylesheet" href="/assets/site.css">
The type="text/css" attribute is unnecessary on a modern HTML stylesheet link. The response still needs a correct Content-Type header, especially when the site sends X-Content-Type-Options: nosniff. With nosniff, a browser blocks a style request whose media type is not text/css.10
UTF-8 is the simplest encoding choice. Current CSS syntax rules give a byte-order mark precedence, then consider an HTTP charset parameter and a narrowly formatted encoding declaration at the start of the file before falling back to contextual encoding information.11 Avoid relying on a legacy @charset line when you control the server header.
Support in Poly
Poly recognizes text/css and .css files as readable source code. You can preview a stylesheet with syntax highlighting and in-file search, find its contents with exact or natural-language queries, and ask the Poly agent to explain selectors, variables, layout rules, or likely cascade problems.
Poly presents and analyzes the stylesheet source. It does not turn a standalone CSS file into a rendered web page, and it does not automatically assemble related HTML, imported stylesheets, fonts, or images. Include those companion files when you want the agent to reason about the finished design rather than the CSS alone.
Converting, minifying, and validating CSS
CSS usually does not need conversion because it is already a portable text format. The operation you need is more often one of these:
- Minify for delivery. Remove unnecessary whitespace and comments with a CSS-aware tool, while retaining the original source and source maps for debugging.
- Compile a preprocessor language. Sass, SCSS, and Less are authoring languages that produce CSS. Their source is not interchangeable with a
.cssfile until it has been compiled. - Bundle project styles. A build tool can resolve imports and combine files, but bundling may change URL paths, cascade order, and source locations.
- Capture a visual result. Apply the stylesheet to its intended HTML or SVG, load all dependencies, and then print or export the rendered page. A standalone stylesheet has no inherent pixels or pages to convert.
Validate the result in the browsers and media modes you support. Minification and compilation should preserve the cascade, custom-property behavior, resource URLs, character encoding, and any source maps your debugging workflow depends on.
Security and privacy considerations
CSS is declarative rather than general-purpose executable code, but it can still affect security and privacy. The media-type registration notes that a stylesheet can hide content and can cause software to fetch referenced images, fonts, sounds, or other stylesheets automatically.2
Treat third-party stylesheets as active page resources:
- Review
@import,url(), and web-font references before using an unfamiliar file. - Use Content Security Policy to restrict permitted style and resource origins.
- Serve styles with
text/cssand enableX-Content-Type-Options: nosniffso non-stylesheet responses are not accepted as CSS.10 - Test accessibility after changes. CSS can alter contrast, focus indicators, visibility, reading order on screen, animation, and print output.
Footnotes
- World Wide Web Consortium. CSS Snapshot 2025. ↩
- Lie, H., Bos, B., and Lilley, C. RFC 2318: The
text/cssMedia Type. RFC Editor, March 1998. ↩ ↩2 ↩3 ↩4 - Internet Assigned Numbers Authority.
text/cssMedia Type Registration. ↩ - World Wide Web Consortium. The World Wide Web Consortium Issues Cascading Style Sheets Recommendation. ↩
- World Wide Web Consortium. CSS Snapshot 2025: CSS Levels. ↩
- Microsoft. CSS, SCSS and Less in Visual Studio Code. ↩
- JetBrains. CSS in WebStorm. ↩
- Google. View and Change CSS with Chrome DevTools. ↩
- MDN Web Docs. Media Types:
text/css. ↩ - MDN Web Docs. MIME Type Verification. ↩ ↩2
- World Wide Web Consortium. CSS Syntax Module Level 3: The Input Byte Stream. ↩