Tip#102: Did you know… How to specify tag specific formatting

Let’s see this with an example.  I have the following html code on my page.


Now if I format the document by selecting Edit –> Format document (or Ctrl K, Ctrl D)


The document becomes


I want the content inside td should remain on the same line after formatting the document.

Following steps would show how you can specify tag specific formatting for the Visual Studio editor

  1. Right click on the editor in an aspx file and select Formatting and Validation... (or alternatively you can go from Menu Tools-> Options -> Text Editor -> HTML -> Formatting)


  2. From the options dialog select 'Tag specific options'

  3. On the tag specific dialog you can select a tag or create new one and select various formatting options. For this example, I selected Client HTML Tags –> td and then set Line breaks as none and click Ok.

  4. Now if I format the document, there are no line breaks added to the content of the td.

Hope this helps,

Deepak Verma
SDET | Visual Web Developer

No Comments