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). 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> </strong>), Dreamweaver helpfully removes it.

Note

If you only use Dreamweaver’s Design view to create the HTML for your web pages, you don’t have to worry about these code-rewriting options. ...

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.