28

I'm looking for a plugin for Notepad++ that will auto align (auto format) my Css files. Something similar to visual studio ctrl+k, ctrl+d effect only for notepad++.

Anybody know something like that? enter image description here

Gil Epshtain
  • 8,670
  • 7
  • 63
  • 89

1 Answers1

-6

try JSON Viewer... after installing select all content of css and "Ctrl + shift + alt + m" . It will format your css.

suyog patil
  • 412
  • 3
  • 13
  • 12
    I tried this but it formatted the css according to javascript rules not according to css rules. It made the css less readable instead of more readable, imo. – Jason L. Aug 13 '15 at 19:00
  • 7
    There are some online tools to beauty css like http://www.codebeautifier.com/ and http://www.cleancss.com/css-beautify/ – suyog patil Dec 11 '15 at 08:53
  • 1
    Downvoted, because obviously it wasn't tested. When I tried, as @JasonL. said, it made the code less readable and not arranged it according to CSS rules. – Burak Karakuş Jul 12 '16 at 11:10
  • 1
    I agree. This doesn't work. It formats JSON not css. – LozzerJP Nov 18 '16 at 07:45
  • 1
    It does not work for css. I tried and failed. – NoName Jul 18 '17 at 08:48
  • i found it here: [JSONViewer Notepad++ plugin download | SourceForge.net](https://sourceforge.net/projects/nppjsonviewer/?source=typ_redirect) but be careful, because you need to perform these replaces after it: `[ = | - | % | / | # ]` to `[=|-|%|/|#]` an still you have trouble with lines like this: `animation: spin .6s;` because will translate like this: `animation: spin.6s;` – eapo May 20 '18 at 02:26
  • Also, be careful because it strips the first period of the file when you start with a class selector, and it also strips the last } – Chris Sprague Aug 27 '18 at 11:11
  • it works only for json not for css – Tanuj Verma Feb 11 '20 at 05:11
  • https://www.javamadesoeasy.com/2016/12/how-to-format-css-in-notepad.html worked for me – elPolloLoco Mar 25 '20 at 10:25
  • This just deletes all the text for me. :( – Richard A Mar 26 '20 at 22:25
  • @elPolloLoco JSTool wrecks your CSS because it formats the file according to JavaScript rules (it's ok if you're just looking for something in a minified CSS file, but **DON'T SAVE** the formatted version! Close it without saving once you found what you're looking for.). I'm shocked that there's no dedicated plugin for CSS in Notepad++ how did it not happen yet?! – ADTC Feb 22 '21 at 03:16
  • 1
    @ADTC thx, thats some good advice – elPolloLoco Feb 23 '21 at 11:52
  • @elPolloLoco thank you. Yes the most obvious anomaly is that it changes all the `-` to be `‍ - ‍` instead (with spaces around the dash), perhaps because it thinks it's the subtraction operator in JavaScript. If you find/replace it back to `-` you'll get some semblance of CSS, but you'll still find other anomalies. – ADTC Feb 24 '21 at 01:35