How to set default formatting of inline styles?

Currently, inline styles are formated in such a way:

<div style='color: black; background-color: white;'>

I really do not like spaces after colon! I would love to have inline styles formated in a following manner:

<div style='color:black; background-color:white;'>

Is it possible to customize default inline styles formatting in PhpStorm or not?

Thanks ahead!

Comment actions Permalink

Hi there,

There is "Settings/Preferences | Editor | Code Style | CSS | Other | Spaces: After colon" option. It works for new stuff when you write your rules ... but does not seem to affect existing inline styles when reformatting.

Comment actions Permalink


Thank you for your prompt feedback, Andriy - but unfortunately the editor does not make any difference between formatting of CSS styles within separate <style></style> blocks where format with space after colon is appropriate, and inline CSS styles, where space after colon is inapproriate.

To make it clear - in my humble opinion this CSS formatting is right:

<style type="text/css>
h1, h2 {
     color: black;
     background-color: white;


<div ; background-color:black;></div>

You may see the difference in formatting of inline styles vs. styles within a style block.

I would really love PhpStrom could follow such a convention.


Comment actions Permalink

Feel free to submit such Feature Request ticket to the Issue Tracker.

I personally see no reason why it should behave differently in such particular aspect -- i.e. if you are trying to have compact code in style attribute .. then why do you still like to have a space between properties?..

Comment actions Permalink

This is all about readibility, Andryi

In case of style blocks, adding spaces after colon improve overall readibility as particular definitions are positioned in new lines.
In case of inline styles - inidividual definitions are all in one line, so skiping spaces after colons helps finding where individual style definition begins.



Please sign in to leave a comment.