Creating Snippets

Dreamweaver comes with a lot of snippets, and you may find many of them irrelevant to what you want to do. 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 form select menu (see Pull-Down Menus and Lists) 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> section of a page, you need to switch to Code view first.

  2. In the Snippets panel, click the New Snippet button.

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


    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 your snippet 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 ...

Get Dreamweaver CS6: The Missing Manual now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.