Note:

The user interface has been simplified in Dreamweaver CC and later. As a result, you may not find some of the options described in this article in Dreamweaver CC and later. For more information, see this article.

Create a library item

Library items are elements that you want to reuse or update frequently throughout your website.

Create a library item based on a selection

  1. In the Document window, select a portion of a document to save as a library item.
  2. Do one of the following:
    • Drag the selection into the Library category .

    • Click the New Library Item button  at the bottom of the Library category.

    • Select Modify > Library > Add Object To Library.

  3. Type a name for the new library item, then press Enter (Windows) or Return (Macintosh).

    Dreamweaver saves each library item as a separate file (with the file extension .lbi) in the Library folder of the site’s local root folder.

Create an empty library item

  1. Make sure nothing is selected in the Document window.

    If something is selected, it will be placed in the new library item.

  2. In the Assets panel, select the Library category .
  3. Click the New Library Item button  at the bottom of the panel.
  4. While the item is still selected, enter a name for it, then press Enter (Windows) or Return (Macintosh).

Insert a library item into a document

When you add a library item to a page, the actual content is inserted in the document along with a reference to the library item.

  1. Place the insertion point in the Document window.
  2. In the Assets panel, select the Library category .
  3. Do one of the following:
    • Drag a library item from the Assets panel to the Document window.

    Note:

    To insert the contents of a library item without including a reference to the item in the document, press Control (Windows) or Option (Macintosh) while dragging an item out of the Assets panel. If you insert an item this way, you can edit the item in the document, but the document won’t be updated when you update pages that use that library item.

    • Select a library item, and click Insert.

Edit library items and update documents

When you edit a library item, you can update all documents that use that item. If you choose not to update, the documents remain associated with the library item; you can update them later.

You can rename items to break their connection with documents or templates, delete items from the site’s library, and recreate a missing library item.

Note:

The CSS Styles panel is unavailable as you edit a library item, because library items can contain only body elements and Cascading Style Sheets (CSS) code is inserted in the head section of a document. The Page Properties dialog box is also unavailable, because a library item can’t include a body tag or its attributes.

Edit a library item

  1. In the Assets panel, select the Library category .
  2. Select a library item.
  3. Either Click the Edit button  or double-click the library item.

    Dreamweaver opens a new window, similar to the Document window, for editing the library item. The gray background indicates that you’re editing a library item instead of a document.

  4. Make and then save your changes.
  5. Specify whether to update the documents on the local site that use the library item. Select Update to update immediately. If you select Don’t Update, documents won’t be updated until you choose Modify > Library > Update Current Page or Update Pages.

Update the current document to use the current version of all library items

  • Select Modify > Library > Update Current Page.

Update the entire site or all documents that use a particular library item

  1. Select Modify > Library > Update Pages.
  2. In the Look In pop‑up menu, specify what to update:
    • To update all pages in the selected site to use the current version of all library items, select Entire Site, then select the site name from the adjacent pop‑up menu.

    • To update all pages in the current site that use the library item, select Files That Use, then select a library item name from the adjacent pop‑up menu.

  3. Make sure that Library Items is selected in the Update option.

    Note:

    To update templates at the same time, select Templates as well.

  4. Click Start.

    Dreamweaver updates the files as indicated. If you selected the Show Log option, Dreamweaver generates a report showing whether files were updated successfully, along with other information.

Rename a library item

  1. In the Assets panel, select the Library category .
  2. Select the library item, pause, and then click again. (Do not double-click; double-clicking opens the item for editing.)
  3. Enter a new name.
  4. Click elsewhere, or press Enter (Windows) or Return (Macintosh).
  5. Specify whether to update documents that use the item by choosing either Update or Don’t Update.

Delete a library item from a library

When you delete a library item, Dreamweaver removes it from the library but doesn’t change the contents of any documents that use the item.

  1. In the Assets panel, select the Library category .
  2. Select the library item.
  3. Either click the Delete button or press the Delete key, then confirm that you want to delete the item.

    Note:

    If you delete a library item, you can’t use Undo to retrieve it. You may be able to recreate it, however.

Recreate a missing or deleted library item

  1. Select an instance of the item in one of your documents.
  2. Click the Recreate button in the Property inspector (Window > Properties).

Customize highlighting of library items

You can customize the highlight color of library items and show or hide highlighting by setting Highlighting preferences.

Change the highlight color of library items

  1. Select Edit > Preferences (Windows) or Dreamweaver > Preferences (Macintosh).
  2. Select the Highlighting category from the list on the left of the Preferences dialog box.
  3. Click the Library Items color box, then select a highlight color using the color picker (or enter the hexadecimal color value in the text box).
  4. Select Show to display the highlight color in the Document window.
  5. Click OK.

To show or hide highlighting in the Document window

  • To show highlighting, select View > Visual Aids > Invisible Elements. To hide highlighting, deselect Invisible Elements.

Edit the properties of a library item

You can use the Property inspector to open a library item for editing, detach a selected library item from its source file, or overwrite an item with the currently selected library item.

  1. Select a library item in a document.
  2. Select one of these options in the Property inspector (Window > Properties):

    Src

    Displays the filename and location of the source file for the library item. You can’t edit this information.

    Open

    Opens the library item’s source file for editing. This is equivalent to selecting the item in the Assets panel and clicking the Edit button.

    Detach From Original

    Breaks the link between the selected library item and its source file. You can edit the detached item in the document, but it’s no longer a library item and isn’t updated when you change the original.

    Recreate

    Overwrites the original library item with the current selection. Use this option to re-create library items if the original library item is missing or has been accidentally deleted.

Make library items editable in a document

If you’ve added a library item to your document and you want to edit the item specifically for that page, you must break the link between the item in the document and the library. Once you’ve made an instance of a library item editable, that instance isn’t updated when the library item changes.

  1. Select a library item in the current document.
  2. Click Detach From Original in the Property inspector (Window > Properties).

Edit a behavior in a library item

To edit a behavior in a library item, you must first insert the item in a document, then make the item editable in that document. After you’ve made the changes, you can re-create the library item, replacing the item in the library with the edited item from your document.

  1. Open a document that contains the library item.

    Note the name of the library item, as well as the exact tags it contains. You’ll need this information later.

  2. Select the library item, and then click Detach From Original in the Property inspector (Window > Properties).
  3. Select the element that has the behavior attached to it.
  4. In the Behaviors panel (Window > Behaviors), double-click the action you want to change.
  5. In the dialog box that appears, make your changes, then click OK.
  6. In the Assets panel, select the Library category .
  7. Record the exact name and capitalization of the original library item; select it, then click the Delete button.
  8. In the Document window, select all the elements that make up the library item.

    Be careful to select exactly the same elements that were in the original library item.

  9. In the Assets panel, click the New Library Item button , then give the new item the same name as the item you deleted, using the same spelling and capitalization.
  10. To update the library item in your site’s other documents, select Modify > Library > Update Pages.
  11. In the Look In pop‑up menu, select Files That Use.
  12. In the adjacent pop‑up menu, select the name of the library item you just created.
  13. In the Update option, make sure Library Items is selected, then click Start.
  14. When the updates are complete, click Close.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy