Partager via


Tag Specific Options

Use the Tag Specific Options dialog box to customize how the HTML designer formats markup for individual tags. You can set general formatting options for all tags by using the Format, HTML, Text Editor, Options Dialog Box.

The settings that you make in the Tag Specific Options dialog box are used when you do the following:

  • Drag controls from the Toolbox onto the page.

  • Use Microsoft IntelliSense functionality to create tags in Source view.

  • Generate markup by using a dialog box, such as the Insert Table Dialog Box.

  • Reformat the selection or document manually by using the Format Document or Format Selection command on the Edit menu.

Setting tag-specific options is useful, if you frequently use certain tags and want to customize how the tags are formatted in the editor. Per-tag formatting lets you set the following options for tags:

  • Closure; that is, not closed, self-terminated, or with a separate closing tag.

  • Line breaks.

  • Indentation.

  • Color.

  • Outlining.

    Note

    Tag-specific formatting rules that you specify can be overridden by the rule that the HTML editor will not change the rendering of tags. If a tag formatting rule would change the way a tag is rendered, the rule is ignored.

To access the Tag Specific Options dialog box

  1. On the Tools menu, click Options.

    The Options dialog box appears.

  2. Select the Show all settings check box, if the development environment is set to Web Development Settings.

    For more information, see Working with Settings.

  3. Expand the Text editor node, expand the HTML node, and then click Format.

  4. Click Tag Specific Options.

    The Tag Specific Options dialog box appears.

Tasks

Note

Outlining for HTML tags follows the same conventions as outlining code in the code editor.

Default Formatting

Per-tag tag formatting works on a model wherein there are default settings for each tag that provide the base rules by which the tag is formatted. There are four categories of tags, as follows:

  • Client tags that do not support contents, such as br /.

  • Client tags that support contents, such as table or h1.

  • Server tags that do not support contents, such as asp:CheckBox.

  • Server tags that support contents, such as asp:Repeater.

For each tag, the values from the appropriate category in the preceding list are used, unless an override is specified for that tag. By default, some overrides are supplied based on the common usage of the tags.

UI Elements

  • Tree view
    Displays a tree view in which you can select either the individual tag to format or a class of tags. By default, the tree contains the following nodes:

    • Default Settings

      Expand this node to set default formatting options for a complete class of tags, such as all server tags that support contents.

    • Client HTML Tags

      Expand this node to set custom formatting options for HTML elements.

    • ASP.NET Controls

      Expand this node to set custom formatting options for ASP.NET server controls.

    To add a new folder to the tree, so that you can organize your own formatting options, click New Folder.

  • New Tag
    Click to create a new tag in the selected folder.

    Generally, you create a new tag when you are defining custom formatting behavior for a specific control or element or when you want to define formatting for a tag that is not already an ASP.NET server control or HTML element.

  • New Folder
    Click to create a new folder to contain tags, which you can then use to organize your custom formatting options.

  • Delete
    Click to remove the custom formatting rules for the currently selected tag.

  • Closing tag
    Click an option to specify how a new tag will be generated by the editor.

    Existing tags are not changed unless you explicitly reformat the document.

    This option is available only when you have selected a tag.

  • Line breaks
    Click an option that specifies how the editor will space the tag when generating or reformatting it.

    Note

    The options that you select might be overridden, if adding spacing and line breaks will change how the control is rendered. For detailed information, see Formatting Elements in the HTML Editor in Visual Web Developer.

  • Indent contents
    Select this check box to specify that elements that support inner content will indent the inner content.

  • Enable outlining for tag
    Select this check box, if you want to enable automatic outlining in the HTML editor for the selected tag.

    When outlining is enabled, the editor monitors the number of lines in the element, and then applies outlining to the tag when the element exceeds the specified line threshold. (The editor does not automatically collapse the tag.). This feature is useful for collapsing long elements, such as large tables.

  • Minimum lines
    Specify the threshold, in lines, after which to apply automatic outlining to the tag.

    The threshold includes the opening and closing tags.

  • Tag foreground
    Select the text color that the editor will use to display the tag.

  • Tag background
    Select the background color that the editor will use to display the tag.

  • Bold
    Click this option to specify that the editor will display the tag in bold.

  • Custom
    Click to choose a color that is not listed.

  • Preview
    View how the selected tag will appear in the editor with the current settings.

    Note

    The Preview box might not reflect the actual behavior of a tag in the editor. Formatting options can be overridden by other rules that take precedence, such as the rule that automatic formatting cannot change how a control is rendered.

See Also

Tasks

Walkthrough: Advanced HTML Editing in Visual Web Developer

How to: Outline and Hide Code