The pageLayout property sets your element positioning preferences for the current HTML document. The values available for this property are:
- GridLayout Absolute positioning attributes are inserted into elements that are added, and updated in elements that are moved. Elements can be dragged across the Design view surface. The positioning grid and Snap to Grid are available.
- FlowLayout Elements are added without absolute positioning attributes. Web browsers arrange elements in the order that they occur on the page, from top to bottom. You cannot drag elements across the Design view surface, or use the positioning grid.
You can set the pageLayout property either from the Properties window or from the DOCUMENT Property Pages dialog box.
The default value of the pageLayout property is "GridLayout" for new HTML pages and Web forms created within Visual Basic .NET or Visual C# Web Applications. Setting the pageLayout property to "GridLayout" in Visual Studio .NET inserts an ms_positioning attribute into the <BODY> element of an HTML document:
<BODY ms_positioning="GridLayout">
Resetting this property to "FlowLayout" removes the ms_positioning attribute:
For HTML pages and Web forms added to Empty Web Projects, the default value of the pageLayout property is "FlowLayout." When you add an existing HTML document to a Visual Studio .NET solution or project, and its <BODY> element does not include an ms_positioning="GridLayout" attribute, the HTML Designer opens the document for editing with its pageLayout property set to FlowLayout.
When you set the value of the pageLayout property to GridLayout, you can then set the value of the showGrid property to True and display the Design view positioning grid. If Snap to Grid is enabled in the Display, HTML Designer Options dialog box, it is activated. Elements dragged across the Design view surface will automatically be aligned with the nearest positioning grid guidelines when you release the mouse.
When an HTML element is repositioned on the Design view surface, its positioning attributes are adjusted automatically in your markup. Use HTML view to make fine adjustments to the positioning attributes of particular elements.
Note Switching views can reformat your markup.
See Also
HTML and XML Schema Extensibility | Properties Window | General Tab, DOCUMENT Property Pages Dialog Box | Display, HTML Designer, Options Dialog Box | Position, Style Builder Dialog Box | Design View, HTML Designer | HTML View, HTML Designer | Positioning HTML Elements in Design View | Switching to Design View