Solution:

In order to allow single-line blocks in VSCode using Prettier - Code formatter extension, please take the following steps:

  1. Enable stylelint integration by adding this in the VSCode Settings (JSON): "prettier.stylelintIntegration": true
  2. Install stylelint and stylelint-prettier npm modules in your project directory. npm install stylelint stylelint-prettier --save-dev
  3. Add a .stylelintrc.json file at the root of your project directory with the following code:
    {
        "plugins": ["stylelint-prettier"],
        "rules": {
            "block-closing-brace-newline-after": "always-multi-line",
            "block-closing-brace-empty-line-before": "never",
            "block-closing-brace-space-before": "always",
            "block-opening-brace-space-after": "always",
            "block-opening-brace-space-before": "always",
            "block-closing-brace-newline-before": "always-multi-line",
            "block-opening-brace-newline-after": "always-multi-line",
            "indentation": 4
        }
    }

You can add/customize more stylelint rules, see the entire list of rules here.

Took me a while to understand how to configure these options, if you're starting out with stylelint, I highly recommend you read its guidelines first.

Answer from Arslan Akram on Stack Overflow
🌐
GitHub
github.com › prettier › prettier-vscode › issues › 117
Prettier doesn't format *.css and *.scss files. · Issue #117 · prettier/prettier-vscode
But there is no "Format document" option in the content menu in vscode for *.css and *.scss files. ... What I am doing wrong? Prettier formats .js files fine.
Author   ghost
🌐
Reddit
reddit.com › r/vscode › prettier not formatting css
r/vscode on Reddit: Prettier not formatting css
September 24, 2024 -

Hey everyone, for the life of me I can't figure out why prettier won't format css. I have gone over all of my setting, format on save, setting prettier as the default format, and checked the setting.json file. Still can't figure out what is going on. Any help would be appreciated!

🌐
Stack Overflow
stackoverflow.com › questions › 63444953 › vscode-prettier-not-formatting-css
visual studio code - VSCode Prettier not formatting CSS - Stack Overflow
I am using the Prettier 5.1.3 extension in VSCode for Windows. It works very good with html but it doesn't work with css pages. I even reinstalled the whole VSCode, delete all settings files, reins...
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-format-code-with-prettier-in-visual-studio-code
Format Code with Prettier in Visual Studio Code: Setup Guide | DigitalOcean
August 1, 2025 - Prettier formats JavaScript or TypeScript, but not HTML, CSS, or Python files. Format on save is inconsistent across languages. ... Language-specific formatter is overriding Prettier: Some file types (like HTML or JSON) may default to the built-in VS Code formatter.
🌐
Mozilla Bugzilla
bugzilla.mozilla.org › show_bug.cgi
1606787 - VSCode prettier extension will automatically format CSS files
Issues related to linting tools (e.g flake8, eslint) and code formatting tools (clang-format). Feature requests for these tools can also be filed here ... This bug is publicly visible. ... It seems that the recommended Prettier extension for VSCode automatically formats CSS.
🌐
Prettier
prettier.io
Prettier · Opinionated Code Formatter · Prettier
Try It OnlineInstall Prettier · Limited edition tshirts are now available to buy! $10 per tshirt goes to maintain the project. An opinionated code formatter · Supports many languages · Integrates with most editors · Has few options » · Your code is formatted on save · No need to discuss style in code review · Saves you time and energy · And more » · JavaScript · JSX · Flow · TypeScript · JSON · CSS ·
Find elsewhere
🌐
Gleb Bahmutov
glebbahmutov.com › blog › configure-prettier-in-vscode
How to configure Prettier and VSCode | Better world by better software
April 23, 2024 - Here is formatting CSS for example. You can configure Prettier and its VSCode extension to format your JSON files. Since there is already a default JSON formatter built into VSCode, you need to tell VSCode to specifically use esbenp.prettier-vscode to format JSON files.
🌐
Alphr
alphr.com › home › how to use prettier in vs code
How To Use Prettier in VS Code
July 18, 2022 - Click on “Prettier – Code Formatter” to format the code. Your document will have the appropriate line wrappings, single quotes and spacing. This process will also work on your CSS files.
🌐
GitHub
github.com › svipas › vscode-prettier-plus
GitHub - svipas/vscode-prettier-plus: Prettier (code formatter) for the VS Code.
See the documentation for how to do that. Use prettier-eslint to format JavaScript, TypeScript and Vue. Use prettier-tslint to format TypeScript. Use prettier-stylelint to format CSS, SCSS and Less.
Starred by 20 users
Forked by 3 users
Languages   TypeScript 89.9% | JavaScript 8.5% | CSS 1.1% | TypeScript 89.9% | JavaScript 8.5% | CSS 1.1%
🌐
GitHub
github.com › prettier › prettier-vscode
GitHub - prettier/prettier-vscode: Visual Studio Code extension for Prettier · GitHub
This extension supports Prettier plugins when you are using a locally or globally resolved version of prettier. If you have Prettier and a plugin registered in your package.json, this extension will attempt to register the language and provide automatic code formatting for the built-in and plugin languages.
Starred by 5.5K users
Forked by 509 users
Languages   TypeScript 78.3% | JavaScript 20.3% | PHP 0.6% | Dockerfile 0.3% | HTML 0.3% | SCSS 0.1%
🌐
OpenReplay
blog.openreplay.com › using-prettier-with-vscode-to-write-javascript
Using Prettier with VSCode to write JavaScript
Open Visual Studio Code and navigate ... Windows/Linux or Cmd+Shift+X on Mac). Search for Prettier - Code formatter” in the search bar and click the “Install” button next to the extension....
🌐
Visual Studio Marketplace
marketplace.visualstudio.com › items
VS Code SCSS Formatter
Extension for Visual Studio Code - A Visual Studio Code Extension to format SCSS
🌐
Prettier
prettier.io › docs › editors
Editor Integration · Prettier
prettier-vscode can be installed using the extension sidebar – it’s called “Prettier - Code formatter.” Check its repository for configuration and shortcuts.
🌐
TMS Outsource
tms-outsource.com › home › how to use prettier in vscode to format code
How to Use Prettier in VSCode to Format Code
December 18, 2025 - You can also right-click in the editor and select “Format Document” or use the Command Palette with Ctrl+Shift+P. Yes. Prettier supports JavaScript, TypeScript, JSON, HTML, CSS, Markdown, YAML, GraphQL, and PHP.
🌐
Scott Sauber
scottsauber.com › 2017 › 06 › 10 › prettier-format-on-save-never-worry-about-formatting-javascript-again
Prettier + Format On Save = Never worry about formatting JavaScript again – Scott Sauber
June 12, 2021 - While I only mentioned JavaScript ... SASS, TypeScript, JSX, Markdown, and more as well. The Prettier -JavaScript Formatter plugin for VS Code simply shells out to Prettier....