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!


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.



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.



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?..


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.



Digging this up seven years later :-)

I always wanted the same thing. Anybody knows if it is possible now to set different code styles for inline and CSS files? Have not found anything in the issue tracker though :/


Elena, thanks for the info and link. But I don't think that issue fits well to what OP and me are looking for.

Is it ok to create a new feature request? I don't want it to be merged with that particular one, because I think they quite differ.


Sure, please feel free to file a new ticket to youtrack on this

Thank you!


Please sign in to leave a comment.