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.

image

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

image

The document becomes

image

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)

    image 

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

    image 

  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.

    image 

  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