targetSchema Property
The targetSchema property selects the validation schema used for designing an HTML document, XML document, or Web forms page. Each available setting names a Web browser for which the document can be designed. To use CSS styles, you must select a Web browser that supports HTML 4.0 or later.
You can set the targetSchema property either from the Properties window or from the DOCUMENT Property Pages dialog box. For more information, see Setting the targetSchema Property of an HTML Document.
The targetSchema property affects the following design-time features within the Visual Studio .NET integrated development environment (IDE):
- The HTML tab of the Toolbox, Insert Item dialog boxes, and automatic statement completion pop-ups.
The items available will be those that are valid according to the validation schema chosen. For example, the
<SPAN>element becomes available when the targetSchema is set to a Web browser that supports HTML 4.0 and later. - HTML elements and attributes generated when you drag an item from the HTML tab of the Toolbox onto the active document.
Certain element properties, such as width and height, will be generated as CSS inline styles on pages designed for more recent Web browsers, or as HTML attributes on pages designed for older browsers.
- DOCUMENT properties displayed in the Properties window and the DOCUMENT Property Pages dialog box.
The properties displayed for certain HTML elements and Web controls will vary from one Web page to another, depending upon whether or not the target browser for the active page supports CSS styles.
- How elements are aligned and positioned.
When the
pageLayoutproperty of the active document is set to GridLayout on pages designed for more recent Web browsers, CSS style attributes are inserted to position elements. On pages designed for older Web browsers, elements are aligned and positioned within tables. - HTML markup validation in HTML view.
When the Enable HTML validation option is selected in the HTML Specific, HTML/XML, Text Editor, Options dialog box, a red wavy line appears in HTML view under any markup that is not valid according to the schema chosen, and a Build Error that describes and links to the problem markup appears in the Task List.
To control the run-time rendering of ASP.NET controls, you must also set the ClientTarget property of the Web form. For details, see ASP.NET Server Controls and Browser Capabilities. The Document Object Model (DOM) of the client Web browser that is used to display the page determines the objects, properties, methods, and events available, and the syntax required in scripts that interact with its HTML elements, attributes, and CSS styles.
Note ThetargetSchemaproperty specifies thetargetNamespaceURI of the schema. In an HTML or Web Form document, this adds a<meta>element. In an XML file, setting this property adds anxmlnsattribute to the root element. In an ASP.NET user control, this adds atargetSchemaattribute to the directive.
See Also
HTML and XML Schema Extensibility | Properties Window | General Tab, DOCUMENT Property Pages Dialog Box | Working With CSS Styles | Creating Scripts and Editing Event Handlers in HTML Designer | Previewing an HTML Page in a Web Browser | Web Browser, Environment, Options Dialog Box | HTML Tab, Toolbox | Working With CSS Styles