Creating and Using Library Items

To create a Library item, start by opening the Library window. Click the Assets tab (to the right of the Files panel) or choose Window→Assets, and then click the Library Items button (it looks like an open book, circled in Figure 19-4) to reveal the Library category.

Now select the part of your document that you wish to save as a Library item: a blob of text, a graphic, or whatever.

Note

however, that Library items can contain only page elements that appear in the document window—in other words, only HTML from the <body> of a web page. You can’t include anything that appears in the <head> of a page, like Cascading Style Sheets, Spry widgets (Chapter 13) or meta tags. This means you can’t store Dreamweaver behaviors or Spry widgets in your Library (but you can include them with a Dreamweaver Template, discussed in the next chapter). Furthermore, Library items must include a complete set of HTML tags—both an opening and a closing tag—as well as all the tags necessary to complete the original object. For example, Dreamweaver doesn’t let you turn just a single cell, row, or column of a table into a Library item. If you try, then Dreamweaver adds the entire table to the Library

Library items are great for small chunks of HTML that you use frequently on a site. Here, on an old version of The Museum of Modern Art’s home page, many of the navigation options on the page (circled) are Library items. If the Museum needed to add or remove a navigation link, they could update the Library item to change every page on the site in one simple step. In fact, since a Library item is a chunk of HTML, the left-hand navigation bar could be replaced with a Flash movie, plain-text links (instead of graphics), or any other valid HTML code.

Figure 19-3. Library items are great for small chunks of HTML that you use frequently on a site. Here, on an old version of The Museum of Modern Art’s home page, many of the navigation ...

Get Dreamweaver CS5: The Missing Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.