O'Reilly logo

Dreamweaver CS5: The Missing Manual by David Sawyer McFarland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating Snippets

Dreamweaver comes with a lot of snippets, and you may find many of them irrelevant. No problem—you can easily create your own. Here’s how:

  1. Create and select the content you wish to turn into a snippet.

    You could, for instance, select a table in Design view, or select the opening and closing <table> tags (as well as all the code between them) in Code view. Or, if you want to save a pull-down form menu (see Radio Group) that took you half an hour to build, then, in Design view, just click the form menu.

    If you want to make a snippet out of code that isn’t visible in Design view, such as a JavaScript program or content that appears in the <head> of a page, you need to switch into Code view first.

  2. In the Snippets panel, click the New Snippet button (Figure 19-1).

    The Snippet window appears (Figure 19-2), displaying the code you selected in the Insert field.

    Note

    If you skip step 1 and just click the New Snippet button, you can either type the code or, in the Insert box, paste a previously copied selection (see step 6).

  3. Title the snippet.

    The name you type in the Name field appears in the Snippets panel. Make sure to give it a name that clearly describes what it does.

  4. In the Description field, type identifying details.

    This step is optional, but useful. Use this field to describe when and how to use the snippet, and whether or not the snippet wraps a selection.

  5. Select a Snippet type.

    “Wrap selection” makes the code wrap around a selection when you use the snippet. The “Insert block” ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required