3

VS2008で作業するときは、時間を大幅に節約できるため、Ctrl + K+Dを頻繁に使用します。

しかし、CSSファイルでは、このコマンドは私があまり好きではない方法でドキュメントをフォーマットします。

たとえば、ドキュメントを自動フォーマットすると、

.Foo
{
width:1px;
height:2px;
}

ただし、(私の意見では)はるかに読みやすいので、この方法でタグをフォーマットするのが好きです。

.Foo
{ width:1px;
  height:2px; }

だから、私がこれを実装できる方法はありますか?

「タグ固有のオプション」機能は私が必要としているもののようですが、これを行う方法がよくわかりません。

ありがとう。

4

2 に答える 2

7

I just looked in the Visual Studio code formatting options and it appears that there are only three options you can choose from:

  • Compact rules
  • Semi-expanded
  • Expanded

None of these meet your requirements. The formatting options for C# (and other languages) are much more customizable.

Screenshot of the CSS text formatting options dialog in Visual Studio 2008

于 2010-03-17T19:50:56.020 に答える
2

OK, after a long while i came up with an acceptable solution;

copy your css (or upload) to this site and at right, select "High (moderate readability, smaller size)"

and it will turn your css

.foo
{
    font-weight: bold;
    color: #ff0000;
}

into

.foo { font-weight: bold; color: #ff0000; }

(in my case, thats the one i wanted, you can select what you like most, there are five presets and other additional choices.)

于 2011-01-23T22:18:58.510 に答える