When I have to work on HTML files that I’ve gotten from other sources, I often find it useful to format the code by selecting Apply Source Formatting from the Command menu.
However, there are cases when you don’t want Dreamweaver messing with your spacing. To illustrate, take a look at the code below:
<div>foo bar bar bar bar foo</div>
In the browser, this displays as follows:

However, if you apply source formatting to this using the Apply Source Formatting command, Dreamweaver will change the code as follows:
<div>foo bar bar bar bar foo</div>
This changes the way the page is displayed in the browser:

Dreamweaver provides a way to customize how source formatting is applied, but unfortunately, it’s only at the tag-level. Nonetheless, it can be useful. Here is how it works in Windows:
- Select Tag Libraries… from the Edit menu.
- In the Tag Library Editor, scroll down to the div tag and change the Contents to “Formatted But Not Indented” as shown below:

Now div tag content will not be indented when you use the Apply Source Formatting command.
It would be nice if you could do this based on an attribute value. For example, in our courseware system we have a class called “CodeFormat” that is used for displaying code in the courseware. We would like Dreamweaver to honor (i.e, not mess with) whitespace inside div tags with that class, but to make that happen, we have to surrender indenting within all div tags.
Unless anyone knows a work around?
To hear about the latest Adobe news, blogs, and training, subscribe to our newsletter. Click here to subscribe.





Leave a Reply