CSS attributes inline?
I've just upgraded to the latest version and PhpStorm has started forcing me to do css attributes on new lines.
The main offender being emmits with browser prefixes.
For example, I select the emmet for transform, it will put each attribute on a new line. Before the update, I somehow managed to set it up so that it wouldn't do this.
Any ideas or is this just how it is now?!
请先登录再写评论。
Could you please provide an example?
Yeah sure!
So it want's me to code like this:
Where as I prefer writing like this:
Thanks! Will it help if you enable "Keep single-line blocks" in `Settings/Preferences | Editor | Code Style | Style Sheets | CSS`?
You absolute HERO!
Thank you so much!
I've been through those menus so many times and must have completely missed that one.
But, it's only working for CSS rules with one single attribute, isn't it?
I'm a strong advocate for inline rules too!
> CSS rules with one single attribute
Could you please share a code sample it doesn't work with?
As shown in the preview,
body {
background: black;
color: #80c0c0
}
is not turned into a one-line rule.
In real code with “Keep single-line blocks” enabled, actually it doesn't seem that “Reformat Code” does anything in that regard; it just keeps inline inline and multi-line multi-line.
E.g.
ul {
list-style-type: none;
padding-left: 0;
}
is kept as such.
Yes, that's what "Keep single-line blocks" is supposed to do: to keep what is already inlined.
Please feel free to vote for IDEABKL-5471.
I certainly will thanks!
Single-line rules with separates selectors is the best practice to me.