Options that Affect Existing HTML, CSS, or XML Markup
Various settings in the Options dialog box will cause editors in the Visual Studio .NET integrated development environment (IDE) to modify existing HTML, CSS, or XML markup when Automatic Formatting is applied, or when items are added or moved on HTML pages and Web forms.
Before opening a Web project for editing, adding an existing document with HTML, CSS, or XML markup to a Web project, or adding items to an HTML page or Web form, you might want to review your current settings for the following options. The Options dialog box is available from the Tools menu.
Options that Revise Existing Markup
The following options change existing markup, not merely reformat it.
Format, HTML/XML, Text Editor Options Dialog Box
If either of the Apply Automatic Formatting options is selected, then the specific Automatic Formatting preferences set on the Format, Tabs, HTML Specific, and XML Specific HTML/XML Options pages are applied upon the action indicated.
If neither option is selected, these formatting preferences are not applied automatically. To apply Automatic Formatting in the HTML view and XML editors, choose Advanced on the Edit menu and select Format Document.
Apply Automatic Formatting
- When saving document
- When selected, directs Automatic Formatting to reformat your markup whenever you save the document you are editing from Design view.
- When switching from Design to HTML/XML view
- When selected, directs Automatic Formatting to reformat your markup whenever you change from Design view to HTML view.
Automatic Formatting Options
- Apply line breaks
- When selected, directs Automatic Formatting to insert physical line breaks before and after the markup for certain HTML elements, as if you had pressed Enter or Return in the HTML view editor.
- Insert attribute value quotes
- When selected, directs Automatic Formatting to add or retain quotation marks around attribute values (for example id="Select1"). Clear this option if you prefer to insert quotation marks into your markup manually.
Capitalization
- Tags
- Selecting the As Entered option directs Automatic Formatting to leave the names of HTML and XML elements formatted as entered. Selecting either Uppercase or Lowercase directs Automatic Formatting to change the names of HTML elements to the case specified.
- Attributes
- Selecting the As Entered option directs Automatic Formatting to leave the names of HTML and XML attributes and properties formatted as entered. Selecting either Uppercase or Lowercase directs Automatic Formatting to change the names of HTML attributes and properties to the case specified.
Format, CSS, Text Editor Options Dialog Box
Formatting
- Style
- Selecting Compact rules directs Automatic Formatting not to modify CSS style definitions written in a single line. The options Semi-expanded and Expanded insert physical line breaks into CSS style rules.
- Capitalization
- Selecting the As Entered option leaves the names of CSS style selectors and attributes formatted as they appear in existing markup. Selecting either Uppercase or Lowercase will cause Automatic Formatting to reformat all CSS selectors and attribute names to the case specified.
Tabs, HTML/XML, Text Editor Dialog Box Tabs, CSS, Text Editor Dialog Box
- Indenting
- When either the Block or Smart option is selected, tabs are added at the beginning of new lines inserted between the opening and closing tags of an HTML or XML element, or within a CSS style definition.
- Tabs: Insert spaces
- When selected, both auto-indenting and the Tab key insert space characters (ASCII 32) instead of tab characters (ASCII 9). When this option is not selected, tab characters are inserted.
- Tabs: Keep tabs
- When selected, automatic formatting leaves existing tab characters in your document, or converts those at the beginning of indented lines to spaces. When this option is not selected, automatic formatting removes tab characters from existing markup.
General, HTML/XML, Text Editor Dialog Box General, CSS, Text Editor Dialog Box
- Enable virtual space
- When selected, spaces are inserted at the end of each line of code. Select this option to position comments at a consistent point on the right of your markup.
HTML Specific, HTML/XML, Text Editor Dialog Box
- Auto Insert Close tag
- When selected, directs statement completion pop-ups, the Toolbox, and other inserters to automatically insert closing tags when adding elements to your document.
- Auto-Insert: Attribute value quotes
- When selected, directs statement completion pop-ups, the Toolbox, and other inserters to place quotation marks around values assigned to attributes and properties. Clear this option if you prefer to insert quotation marks into your markup manually.
Display, HTML Designer, Options Dialog Box
- Snap to Grid
- When selected, the positioning attributes assigned to elements as they are dropped onto or moved across the Design view surface are automatically adjusted. When you release the mouse, these elements are automatically realigned with the nearest guidelines in the Design view positioning grid.
General, HTML Designer, Options Dialog Box
- Start pages in <view>
- If you select HTML view here and also choose to Apply Automatic Formatting when switching from Design to HTML/XML view, your markup will be reformatted when you open documents, use the Design view editing surface, and then switch back to HTML view.
Options that Reformat Existing Markup
The following options change the appearance of existing markup. The markup is not revised.
General, HTML/XML, Text Editor Dialog Box General, CSS, Text Editor Dialog Box
- Word Wrap
- When selected, markup that extends beyond the limit of the viewable area is automatically displayed on the next line in the editor. Selecting this option does not insert line break characters into your markup.
Fonts and Colors, Environment Options Dialog Box
- Display Items
- Select Text in this field to set the font in which markup is displayed. You also can select various items and values in HTML, CSS, and XML markup, and set the fonts and colors used to distinguish them. These fonts and colors also will appear when you View Source, if you choose to View Source in the HTML editor or Code Editor.
Web Browser, Environment Options Dialog Box
- View source in
- This option makes it possible for you to specify the text editor used when you View in Browser and then View Source. If you prefer to specify the editor used to display your source markup, set this Option to External Editor and enter the path and name of your editor. The setting HTML Editor displays source markup in full HTML view, and Code Editor uses a simpler version of the HTML editor.
Other HTML Options
Web Settings, Projects Options Dialog Box
- Location of Web project cache
- Use this field to specify the location where Visual Studio stores files for active Web projects. For example:
C:\Documents and Settings\jdoe\VSWebCache
See Also
- HTML/XML
- Format, HTML/XML, Text Editor, Options Dialog Box | HTML Specific, HTML/XML, Text Editor, Options Dialog Box | Tabs, HTML/XML, Text Editor, Options Dialog Box | General, HTML/XML, Text Editor, Options Dialog Box
- CSS
- Format, CSS, Text Editor, Options Dialog Box | CSS Specific, CSS, Text Editor, Options Dialog Box | Tabs, CSS, Text Editor, Options Dialog Box | General, CSS, Text Editor, Options Dialog Box
- HTML Designer
- Display, HTML Designer, Options Dialog Box | General, HTML Designer, Options Dialog Box
- Environment
- Fonts and Colors, Environment, Options Dialog Box | Web Browser, Environment, Options Dialog Box
- Projects
- Web Settings, Projects, Options Dialog Box