Creating Elements

Buttons and Menus

The commands on the XHTML and XML menus, and the corresponding buttons in the XHTML palette, let you create new elements at the insertion point within the document. To use the commands from the XHTML and XML menus, place the cursor at the desired position and choose the element type.

Insertion points

When creating new elements, it is important to select an insertion point, not some text nor a single character: if the current selection is not empty, Amaya tries to transform the selected part into the element type chosen.

Element Locations

Sometimes elements cannot be created at the chosen location because of the constraints imposed by the HTML language. Amaya then tries to create the element at the closest valid position. For example, if the insertion point is at the end of the last line of a paragraph when you click on the Heading 2 button H2 Button, Amaya creates the new heading after the paragraph.

In some other cases, Amaya changes the existing structure for creating the desired element at a valid position. If the insertion point is somewhere within a list item (li) when you create a heading, the item and its enclosing list are automatically split, in order to create the requested heading at the chosen position and to comply with the HTML DTD.

Structure submenu

To create elements in the document head, use the XHTML/Structure submenu. This menu is enabled only when the selection is in the head of the document. The head is displayed only in the Structure view. This view should then be open. Put the cursor at the desired position and choose the element type from the Structure submenu.

The Structure submenu also enables you to create comments. Comments are shown only in the Structure view, but they can be inserted at any position in the document.

Generated elements

Some HTML elements are constituted by several other elements of different types. For instance, a table usually contains a caption (caption), several rows (tr), and several cells (td or th) in each row.

When Amaya creates such elements, it also creates their components. A table is created with a caption and a few rows containing several cells. The insertion point is placed automatically in the first of these components. You can enter the content of that component immediately or later. You can move to the next (empty) component with the mouse or with the arrow keys.

The Enter (or Return) Key

When you are writing a new document or a new part in a document, you can create elements sequentially by pressing the Enter (or Return) key. The current element is terminated and a new one is created immediately after.

Most often, the new element created is simply a paragraph, whatever the type of the previous element. You can change the element type by selecting the desired type from the XHTML menu or by clicking the corresponding button in the XHTML palette. You can also keep typing and change the element type later on.

When the cursor is at the end of a preformatted element, hitting the Enter key creates a new line in the pre. To create another element, say a paragraph, after the pre, you have to select the whole pre element with the F2 key and to press Enter.

In the same way, you can create a new paragraph after a table by selecting the whole table and pressing Enter.

When a whole element like h2 or li is selected the Enter key creates a new h2 or li after.

Exiting Anchors, Styled Character Strings, etc.

When a paragraph or another block of text is styled terminated by an anchor or a character string in bold, italic or other such style moving the insertion point to the end and typing new text appends characters to the anchor or the styled string.

To exit an anchor or styled element and enter plain text:

  1. Move the cursor to the end of the anchor or style element, and then press Enter and continue typing after the element.
  2. The same method can be used to enter plain text at the beginning of a block starting with an anchor or styled characters. Move the cursor to the beginning of the anchor or style element, and then press Enter and continue typing before the element.

Creating Nested Structures

When the insertion point is in an empty element, pressing the Enter key replaces that element by another empty element at the next higher level in the document structure. This feature allows you to create complex, nested structures very quickly.

As an example, consider the following structure:

  1. The first item in the list

    A paragraph in the first item

  2. The second item in the list.
    1. First item in the nested list.
    2. Second item in the nested list.
  3. Last item in the list

To create the above structure:

  1. Click the Nubered List button Numbered List to create the first item in the list.

  2. Type in the list item text, and press the Enter key once. Amaya creates a new paragraph within the list item.

  3. Type the paragraph text, and press the Enter key twice. The first Enter creates another paragraph element, but the second Enter removes that paragraph and creates a second bullet list item in the original list.

  4. Type the second list item.

  5. Click the Numbered List button Numbered List to create a new list. The new list is automatically nested within the first list.

  6. Type the text for the first item in the new list, and press the Enter key twice to create a new item in the nested list.

  7. Type the text for the second list item, and press the Enter key four times to create a new list item in the original list.

  8. Type the final list item, and then press the Enter key three times to close the original list and start a new paragraph.

The Enter key works in the same way when the insertion point is at the beginning of an element, but it creates new elements before the current element. For example, to add a list item between the first two items in the above structure, place the cursor at the beginning of the second list item, and press the Enter key twice.

Note:á This use of the Enter key does not apply only to lists and paragraphs, but to all elements.

Changing the Document Title

To edit the document title:

Note:ááá
You can also edit the document title from the Structure view.