Controlling How Dreamweaver Handles HTML

Unlike many other visual HTML editors, Dreamweaver has always graciously accepted HTML written by hand (and even by other programs). In fact, Dreamweaver has always made it easy for you to jump between itself and other text-editing programs like the much-loved but retired HomeSite (for Windows) and BBEdit (for the Mac).

This openness lets you write code the way you want, without worrying that Dreamweaver will change it. For example, suppose you have a particular way of formatting your handwritten code. Maybe you insert an extra hard return after every <td> (table cell) tag, or you like to use multiple tabs to indent nested tags. In cases like these, Dreamweaver doesn’t rewrite your code to fit its own style—unless you ask it to.

Auto-Fixing Your Code

That’s not to say that Dreamweaver doesn’t ever change your code. In fact, the program can automatically fix errors when you open a page created in another program, including:

  • Overlapping tags. Take a look at this example:

    <p><strong>Fix your tags!</p></strong>

    This HTML is invalid, because both the opening and closing <strong> tags should appear inside the <p> tag. Dreamweaver rewrites this snippet correctly:

    <p><strong>Fix your tags!</strong></p>
  • Unclosed tags. Tags usually come in pairs, like this:

    <em>This text is in italic</em>

    But if a page is missing the ending tag (<em>This text is in italic), Dreamweaver adds it.

  • Extra closing tags. If a page has an extra closing tag (<strong>bold text</strong> ...

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.