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
- 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)
- From the options dialog select ‘Tag specific options’
- 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.
- Now if I format the document, there are no line breaks added to the content of the td.
Hope this helps,
SDET | Visual Web Developer