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 Formatting, 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 NIB: 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, choose 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 Customizing Development Settings in Visual Studio.

  3. Expand the Text editor node, expand the HTML node, and then choose Formatting.

  4. Choose 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.

UI Elements

Tag Folders Pane

The left pane of the Tag Specific Options dialog box contains expandable nodes that group tags into Default, HTML, and ASP.NET categories. You can also create a new node by using the New Folder button and adding tags to it by using the New Tag button.

  • Default Settings
    Expand this node to configure default settings for a category of tags. The following table shows examples of tags in each category.

    Client tag does not support contents

    <br />

    Client tag supports contents

    <table>, <h1>

    Server tag does not support contents

    <asp:CheckBox>

    Server tag supports contents

    <asp:Repeater>

  • 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.

  • New Folder
    Click to create a new folder to contain tags.

  • 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. If you want to create a tag that already exists in one of the tag folders, you should modify the tag in its existing location instead, or delete the original tag before creating a new one with the same name. You cannot create a tag if the same tag already exists in one of the tag folders.

  • Delete
    Click to remove the currently selected tag or folder. The Default Settings folder cannot be deleted.

Common Options Pane

The right pane of the Tag Specific Options dialog box contains options common to the nodes in the Tag Folders pane on the left.

Per tag formatting

  • Closing tag
    Choose 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
    Choose 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 NIB: 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.

Outlining in code editor

  • 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.

Per tag colorization

  • 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.

  • Custom
    Click to choose a color by using the Color dialog box. For more information, see More Colors and Color Dialog Boxes.

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

Preview Pane

  • 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

Walkthrough: Advanced HTML Editing in Visual Studio for Web Forms Pages
Outlining