Sharing an example I use in website, I do use following pre in my stylesheet:

pre {
    background: #f4f4f4;
    border: 1px solid #ddd;
    border-left: 3px solid #f36d33;
    color: #666;
    page-break-inside: avoid;
    font-family: monospace;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 1.6em;
    max-width: 100%;
    overflow: auto;
    padding: 1em 1.5em;
    display: block;
    word-wrap: break-word;
}

This gives the following results:

Disclaimer: In my leisure time, I have spend few hours to update this CSS with a bit extra features like code lines and code Copy button using CSS with JavaScript to my personal use that I like to share. Please use as you like github source code. To see a code example in real world, check this article from my blog that show how I use the code sample.

Answer from Maytham Fahmi on Stack Overflow
๐ŸŒ
FreeFormatter
freeformatter.com โ€บ css-beautifier.html
Free Online CSS Beautifier / Formatter - FreeFormatter.com
This free online tool lets you beautify/format your CSS code with no side effects
๐ŸŒ
Static.app
static.app โ€บ css-formatter
CSS Formatter Online - Static.app
Format CSS code online with our free CSS Formatter. Organize and clean up CSS files for better readability and easier maintenance.
People also ask

What does a CSS Formatter / Beautifier do?
A CSS Formatter (or Beautifier) takes CSS code, which might be minified or inconsistently written, and reorganizes it with standard indentation, spacing, and line breaks to make it highly readable for developers without changing how the styles are applied by the browser.
๐ŸŒ
codeshack.io
codeshack.io โ€บ home โ€บ tools โ€บ css formatter
CSS Formatter - Beautify and Format CSS Code Online
Is my CSS code uploaded to your server?
No. This tool operates entirely within your web browser using JavaScript and the Prettier library. Your CSS code is processed locally on your computer and is never sent to or stored on our servers.
๐ŸŒ
codeshack.io
codeshack.io โ€บ home โ€บ tools โ€บ css formatter
CSS Formatter - Beautify and Format CSS Code Online
Is this CSS beautifier tool free?
Yes, absolutely. This online CSS formatter is free to use without any limitations or sign-up requirements.
๐ŸŒ
codeshack.io
codeshack.io โ€บ home โ€บ tools โ€บ css formatter
CSS Formatter - Beautify and Format CSS Code Online
๐ŸŒ
CleanCSS
cleancss.com โ€บ css-beautify
CSS Formatter
Enter your messy, minified, or obfuscated CSS Style Sheets into the field above to have it cleaned up and made pretty. The editor above also contains helpful line numbers and syntax highlighting. There are many option to tailor the beautifier to your personal formatting tastes.
๐ŸŒ
Code Beautify
codebeautify.org โ€บ css-beautify-minify
CSS Formatter, CSS Beautifier and CSS Minifier Online tool
https://codebeautify.org/ css-beautify-minify?input= body{background ยท -color: lightblue}p{mar ยท gin-top: 100px;margin-bo ยท ttom: 100px;margin-ri ยท ght: 150px;margin-le ยท ft: 80px}; Related Tools ยท JS Beautifier CSS minifier JSON Minify STYLUS Compiler ยท Recently visited pages ยท Tags ยท CSS JavaScript Minifiers ยท Buy us a Coffee JSON Formatter FAQ Privacy Policy Content Policy About Contact History Where am I right now?
๐ŸŒ
CodeShack
codeshack.io โ€บ home โ€บ tools โ€บ css formatter
CSS Formatter - Beautify and Format CSS Code Online
Click the "Format CSS" button. The clean, beautified CSS code will appear in the output editor.
๐ŸŒ
W3Schools
w3schools.com โ€บ html โ€บ html_css.asp
HTML Styles CSS
HTML Tag List HTML Attributes HTML Global Attributes HTML Browser Support HTML Events HTML Colors HTML Canvas HTML Audio/Video HTML Doctypes HTML Character Sets HTML URL Encode HTML Lang Codes HTTP Messages HTTP Methods PX to EM Converter Keyboard Shortcuts ... CSS stands for Cascading Style Sheets. CSS saves a lot of work. It can control the layout of multiple web pages all at once. ... Cascading Style Sheets (CSS) is used to format the layout of a webpage.
Find elsewhere
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ utilities โ€บ css-formatter
Free Online CSS Formatter - GeeksforGeeks
April 26, 2024 - Paste your CSS code into the provided editor box. Choose whether you want to format the code or both format and minify it.
๐ŸŒ
CSS-Tricks
css-tricks.com โ€บ different-ways-to-format-css
Different Ways To Format CSS | CSS-Tricks
March 4, 2015 - I prefer multi-line because it is easier to keep the overview if there is a bug in a line. If my dev.toolbar marks an error in line x and the code is in single line i have to search longer then multi-line-code ... I completely agree with you. Thatโ€™s also how i format my css.
๐ŸŒ
Chemical Cloud
chemicloud.com โ€บ webtools โ€บ tool โ€บ css-formatter
CSS Formatter โ€” Free Web Tools for Developers, Marketers, Website Owners
Itโ€™s a must-have tool for anyone working with CSS โ€” from beginners to professionals. ... Instantly count Words or characters in text. Generate dummy text for Design and Development. Split text by commas, lines, or custom delimiters. Clean up repeated lines in text instantly. Remove line breaks and merge text instantly. Extract all links from any block of text instantly. Create Meta Title, Description, and Keywords for any page ... Beautify and format JavaScript Code for better readability.
๐ŸŒ
BeautifyTools
beautifytools.com โ€บ css-beautifier.php
Online CSS Beautifier - CSS Formatter - BeautifyTools.com
Beautify css code using online css beautifier. Enter dirty, minified css code to beautify, format, prettify and make it more readable. The editor has the option to choose different themes and font sizes.
๐ŸŒ
MDN Web Docs
developer.mozilla.org โ€บ en-US โ€บ docs โ€บ MDN โ€บ Writing_guidelines โ€บ Code_style_guide โ€บ CSS
Guidelines for writing CSS code examples - MDN Web Docs | MDN
Formal syntax is an integral part of MDN's CSS documentation (as an example, see the Formal syntax section on the background-image property page). Because a lot of developers are familiar with syntax in this format, it's acceptable to write pseudocode in a formal-syntax-like fashion in descriptions and examples. However, any code that is not syntactically well-formed CSS should not be marked as CSS.
๐ŸŒ
CSS Portal
cssportal.com โ€บ css-formatter
CSS Formatter - CSS Beautifier / Minifier - CSS Portal
Beautify expands CSS into fully indented, human-readable code with each property on its own line. Compact puts each ruleset onto a single line, keeping the structure scannable without the full verbosity. Minify strips all whitespace, comments, and unnecessary characters to produce the smallest possible file size for production use. ... Yes. The formatter fully supports the modern CSS nesting specification, including the & nesting selector, nested @media, @supports, @layer, and @container rules inside rulesets.
๐ŸŒ
Elementor
elementor.com โ€บ home โ€บ css formatter
CSS Formatter: Free Online CSS Beautifier
August 4, 2025 - Simply paste your raw CSS code into the input area. Many tools also allow you to upload a .css file directly. ... Select your desired formatting options, such as indentation level (e.g., 2 spaces, 4 spaces, or tabs).
๐ŸŒ
CKAN
docs.ckan.org โ€บ en โ€บ 2.9 โ€บ contributing โ€บ css.html
CSS coding standards โ€” CKAN 2.9.11 documentation
All CSS documents must use two spaces for indentation and files should have no trailing whitespace. Other formatting rules: Use soft-tabs with a two space indent. Use double quotes. Use shorthand notation where possible. Put spaces after : in property declarations.
๐ŸŒ
Google
google.github.io โ€บ styleguide โ€บ htmlcssguide.html
Google HTML/CSS Style Guide
This document defines formatting and style rules for HTML and CSS. It aims at improving collaboration, code quality, and enabling supporting infrastructure. It applies to raw, working files that use HTML and CSS, including Sass and GSS files.
๐ŸŒ
Scaler
scaler.com โ€บ home โ€บ topics โ€บ css โ€บ css formatter
Free CSS Formatter Online and Beautifier
Then, you can select the CSS indent level you prefer and click on the Format button. Within a few seconds, the tool will format your code, and you can see the formatted output on the right-hand side of the screen.
Top answer
1 of 2
6

Quite sure you can do this with prettier code formatter plugin. And you can set format on save true for all languages by adding the following to your user settings json file(dont forget to reload vscode after updating) :

"editor.formatOnSave": true,   

you can enable format on save for a specific language by adding the following too :

"[css]": {
    "editor.formatOnSave": true
}
2 of 2
0
"[css][scss][less]": {
    "editor.defaultFormatter": "vscode.css-language-features"
}

The JSON configuration you've provided appears to be related to Visual Studio Code (VSCode) settings for formatting CSS, SCSS, and LESS code. This configuration sets the default formatter for these languages to "vscode.css-language-features."

Here's what this configuration does:

"editor.defaultFormatter": This setting in VSCode allows you to specify the default code formatter for a particular language or file type.

"vscode.css-language-features": This value indicates that you want to use the built-in CSS language features of VSCode as the default formatter for CSS, SCSS, and LESS files.

In simpler terms, when you open or edit CSS, SCSS, or LESS files in VSCode, it will use its own internal formatter for those languages by default.

You can customize your VSCode settings by adding or modifying settings in your settings.json file to tailor your development environment to your preferences. This particular configuration is useful if you prefer to use the VSCode built-in formatter for CSS-related languages.

๐ŸŒ
Package Control
packagecontrol.io โ€บ packages โ€บ CSS Format
CSS Format - Packages - Package Control
CSS Format is a CSS formatting plugin for Sublime Text, you can convert CSS/SASS/SCSS/LESS code to Expanded, Compact or Compressed format.
๐ŸŒ
Minifier
minifier.org โ€บ css-formatter
Minify JS and CSS online, or include the minifier in your project for on-the-fly compression.
Use our CSS Formatter & Beautifier to format, clean, and optimize your CSS code. Improve readability, fix indentation, and beautify your stylesheets.