.css File Extension

Learn what a .css file contains, how to open and edit CSS stylesheets, how Poly supports them, and when to use Sass or another alternative.

File extension details for .css

Full Support
File typeCascading Style Sheets stylesheet
MIME type
EncodingUnicode text, preferably UTF-8
Operating systemsWindows, macOS, Linux, ChromeOS
Opens withVisual Studio Code, WebStorm, Notepad, TextEdit, Web browsers
Poly supportYes. Poly recognizes .css as readable stylesheet source.
Indexed by PolyYes. Poly indexes CSS source for exact and semantic search.
Preview in PolyYes. CSS opens in Poly's source editor with syntax highlighting.
Poly agentYes. The Poly agent can read and reason about CSS source.

What kind of file is a .css?

A .css file is a plain-text Cascading Style Sheets stylesheet. It contains selectors, at-rules, declarations, comments, and references that control how structured documents such as HTML and SVG are presented. The registered media type is text/css.1

CSS files have no magic bytes. A file can begin with many valid tokens, so software usually identifies it from the .css suffix, a supplied media type, or its syntax. UTF-8 is the recommended encoding for new stylesheets, although CSS defines decoding rules for older content.2

Renaming an SCSS, Less, HTML, or arbitrary text file to .css does not compile or convert it. It only changes the filename and may cause software to parse the contents as CSS.

How do I open a .css on my computer?

Any plain-text editor can open CSS. Notepad works on Windows, TextEdit can edit plain text on macOS, and common Linux editors work too. A code editor is more comfortable for real projects:

  • Visual Studio Code has built-in CSS syntax highlighting, completion, validation, and color previews.3
  • WebStorm adds completion, formatting, refactoring, and tools for tracing styles applied to a page.4
  • Browser developer tools show which declarations match an element, which lose in the cascade, and where each rule originated.5

A browser can display a stylesheet's source, but CSS alone is not a complete visual document. To see the intended result, load the related HTML or SVG with its fonts, images, imports, viewport settings, and user preferences.

Poly support for .css

Poly opens .css files in its source editor with syntax highlighting, word wrap, and in-file search. It indexes the readable source for exact and semantic search, so you can find a custom property by name or search for styles by purpose.

The Poly agent can explain selectors, variables, media queries, layout rules, and likely cascade problems. It reads the stylesheet rather than executing it or assembling an entire website. Keep related markup and imported stylesheets nearby when the surrounding document matters.

History of .css

Work on CSS began at CERN in 1994. Håkon Wium Lie and Bert Bos co-authored CSS Level 1, which became a W3C Recommendation on December 17, 1996.6 RFC 2318 formally registered text/css in March 1998 and recorded css as its common filename suffix.1

Modern CSS is developed as a collection of modules rather than one numbered, monolithic language. A stylesheet using Grid, custom properties, or container queries still uses .css; compatibility depends on the individual features it contains.

Working with .css and alternatives

Choose the source format that fits the workflow:

ExtensionTypical roleRuns directly in a browser?
.cssPortable stylesheet delivered to browsersYes
.scssSass syntax with variables, nesting, and build-time featuresNo, compile to CSS
.sassIndented Sass syntaxNo, compile to CSS
.lessLess preprocessor sourceNo, normally compile to CSS

Minification is not conversion. It creates a smaller CSS file by removing unnecessary characters and sometimes rewriting equivalent rules. Keep readable source and source maps for maintenance.

Review unfamiliar stylesheets before attaching them to a page. CSS can load external fonts, images, and imported stylesheets through url() and @import, and it can hide or rearrange content.1 Also test keyboard focus, contrast, reduced-motion preferences, printing, and responsive layouts after changes.

Footnotes

  1. Lie, H., Bos, B., and Lilley, C. RFC 2318: The text/css Media Type. RFC Editor, March 1998. 2 3
  2. World Wide Web Consortium. CSS Syntax Module Level 3: The Input Byte Stream.
  3. Microsoft. CSS, SCSS and Less in Visual Studio Code.
  4. JetBrains. CSS in WebStorm.
  5. Google. View and Change CSS with Chrome DevTools.
  6. World Wide Web Consortium. The World Wide Web Consortium Issues Cascading Style Sheets Recommendation.
© Poly Corp. 2026