共用方式為


How to: Position Elements in Design View

By default, elements in an HTML page or ASP.NET Web page are rendered in the order that they appear in the markup, which is sometimes referred to as flow layout. You can also lay out elements two-dimensionally, positioning elements with horizontal and vertical coordinates anywhere on the page. This layout option takes advantage of the positioning options that are available through styles.

To help you work with static text or to position elements as a group, you can create a layer, which is a div element with positioning information.

You can set positioning for individual elements on the page. You can also set an option to set positioning automatically for all of the elements that you add to the page by dragging or by pasting from the Clipboard.

To position an element with horizontal and vertical coordinates

  1. In Design view, select the element that you want to position.

  2. On the Format menu, click Set Position, and then click Absolute or Relative.

  3. Drag the control to where you want it.

    NoteNote:

    If the element is set to use pixels for positioning units, which is the default in Visual Web Developer, you can constrain dragging to an invisible grid. For details, see CSS Positioning, HTML Designer, Options Dialog Box.

To reset elements to flow layout

  1. In Design view, select the element that you want to reset to flow layout.

  2. On the Format menu, click Position....

  3. In the Position dialog box, select None under Positioning style. This setting removes all of the positioning information.

See Also

Concepts

Positioning Elements in Design View