Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Fold CSSNew to Visual Studio Code? Get it now.
Fold CSS

Fold CSS

John Call

|
1 install
| (0) | Free
Tells VsCode what regions are foldable in a CSS file
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

CSS Folding Range Provider

A VS Code extension that provides proper folding ranges for CSS, SCSS, and SASS files based on brace nesting levels.

Features

  • Creates folding ranges for all nested CSS blocks
  • Supports overlapping/nested folding regions
  • Correctly handles multi-line comments (/* */)
  • Works with both K&R and Allman brace styles
  • Works with CSS, SCSS, and SASS files

Before & After

Before

Without this extension, VS Code's default CSS folding may not properly handle deeply nested structures:

Before

After

With this extension, all brace-delimited blocks are properly foldable at their correct nesting levels:

After

Installation

Install from the VS Code Marketplace, then add this to your settings.json to use this extension instead of the built-in CSS folding:

"[css]": {
  "editor.defaultFoldingRangeProvider": "jcall-engineer.fold-css"
},
"[scss]": {
  "editor.defaultFoldingRangeProvider": "jcall-engineer.fold-css"
},
"[sass]": {
  "editor.defaultFoldingRangeProvider": "jcall-engineer.fold-css"
}

How It Works

The extension parses CSS files character-by-character, tracking:

  • Opening and closing braces ({ and })
  • Multi-line comment blocks (/* */)
  • Brace nesting depth using a stack

Each matching pair of braces creates a folding range, allowing for proper nested folding. When braces are on their own line (Allman style), the fold starts from the previous line.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft