Open a supported file.
- Dreamweaver User Guide
- Introduction
- Dreamweaver and Creative Cloud
- Dreamweaver workspaces and views
- Set up sites
- About Dreamweaver sites
- Set up a local version of your site
- Connect to a publishing server
- Set up a testing server
- Import and export Dreamweaver site settings
- Bring existing websites from a remote server to your local site root
- Accessibility features in Dreamweaver
- Advanced settings
- Set site preferences for transferring files
- Specify proxy server settings in Dreamweaver
- Synchronize Dreamweaver settings with Creative Cloud
- Using Git in Dreamweaver
- Manage files
- Create and open files
- Manage files and folders
- Getting and putting files to and from your server
- Check in and check out files
- Synchronize files
- Compare files for differences
- Cloak files and folders in your Dreamweaver site
- Enable Design Notes for Dreamweaver sites
- Preventing potential Gatekeeper exploit
- Layout and design
- CSS
- Understand Cascading Style Sheets
- Laying out pages using CSS Designer
- Using CSS preprocessors in Dreamweaver
- How to set CSS Style preferences in Dreamweaver
- Move CSS rules in Dreamweaver
- Convert inline CSS to a CSS rule in Dreamweaver
- Work with div tags
- Apply gradients to background
- Create and edit CSS3 transition effects in Dreamweaver
- Format code
- Page content and assets
- Set page properties
- Set CSS heading properties and CSS link properties
- Work with text
- Find and replace text, tags, and attributes
- DOM panel
- Edit in Live View
- Encoding documents in Dreamweaver
- Select and view elements in the Document window
- Set text properties in the Property inspector
- Spell check a web page
- Using horizontal rules in Dreamweaver
- Add and modify font combinations in Dreamweaver
- Work with assets
- Insert and update dates in Dreamweaver
- Create and manage favorite assets in Dreamweaver
- Insert and edit images in Dreamweaver
- Add media objects
- Adding videos in Dreamweaver
- Insert HTML5 video
- Insert SWF files
- Add audio effects
- Insert HTML5 audio in Dreamweaver
- Work with library items
- Using Arabic and Hebrew text in Dreamweaver
- Linking and navigation
- jQuery widgets and effects
- Coding websites
- About coding in Dreamweaver
- Coding environment in Dreamweaver
- Set coding preferences
- Customize code coloring
- Write and edit code
- Code hinting and code completion
- Collapse and expand code
- Reuse code with snippets
- Lint code
- Optimize code
- Edit code in Design view
- Work with head content for pages
- Insert server-side includes in Dreamweaver
- Using tag libraries in Dreamweaver
- Importing custom tags into Dreamweaver
- Use JavaScript behaviors (general instructions)
- Apply built-in JavaScript behaviors
- About XML and XSLT
- Perform server-side XSL transformations in Dreamweaver
- Performing client-side XSL transformations in Dreamweaver
- Add character entities for XSLT in Dreamweaver
- Format code
- Cross-product workflows
- Installing and using extensions to Dreamweaver
- In-App updates in Dreamweaver
- Insert Microsoft Office documents in Dreamweaver (Windows only)
- Working with Fireworks and Dreamweaver
- Edit content in Dreamweaver sites using Contribute
- Dreamweaver-Business Catalyst integration
- Create personalized email campaigns
- Templates
- About Dreamweaver templates
- Recognizing templates and template-based documents
- Create a Dreamweaver template
- Create editable regions in templates
- Create repeating regions and tables in Dreamweaver
- Use optional regions in templates
- Define editable tag attributes in Dreamweaver
- How to create nested templates in Dreamweaver
- Edit, update, and delete templates
- Export and import xml content in Dreamweaver
- Apply or remove a template from an existing document
- Edit content in Dreamweaver templates
- Syntax rules for template tags in Dreamweaver
- Set highlighting preferences for template regions
- Benefits of using templates in Dreamweaver
- Mobile and multiscreen
- Dynamic sites, pages and web forms
- Understand web applications
- Set up your computer for application development
- Troubleshoot database connections
- Removing connection scripts in Dreamweaver
- Design dynamic pages
- Dynamic content sources overview
- Define sources of dynamic content
- Add dynamic content to pages
- Changing dynamic content in Dreamweaver
- Display database records
- Provide and troubleshoot live data in Dreamweaver
- Add custom server behaviors in Dreamweaver
- Building forms using Dreamweaver
- Use forms to collect information from users
- Create and enable ColdFusion forms in Dreamweaver
- Create web forms
- Enhanced HTML5 support for form elements
- Develop a form using Dreamweaver
- Building applications visually
- Build master and detail pages in Dreamweaver
- Build search and results pages
- Build a record insert page
- Build an update record page in Dreamweaver
- Building record delete pages in Dreamweaver
- Use ASP commands to modify database in Dreamweaver
- Build a registration page
- Build a login page
- Build a page that only authorized users can access
- Securing folders in Coldfusion using Dreamweaver
- Using ColdFusion components in Dreamweaver
- Test, preview, and publish websites
- Troubleshooting
Set preferences that control the format of your code whenever you create or edit a file.
Format code manually
-
-
Select Edit > Code > Apply Source Formatting.
Or, select Apply Source Formatting from Common Toolbar > Format Source Code.
Format selected code in a file manually
-
Open the code.
-
Select any part of the code.
-
Select Edit > Code > Apply Source Formatting To Selection.
Or, select Apply Source Formatting to selection from Common toolbar-> Format Source Code.
Note:If you select a code in between of any tag and apply source formatting to the selection, then formatting is applied till the parent tag.
Edit default rules for code formatting
You can customize the CSS, JS, and PHP code formatting by adding formatting rules in .jsbeautifyrc file in your site root folder.
To add the .jsbeautifyrc file, follow the steps:
- The following instructions are applicable only for CSS, JS, and PHP documents.
- HTML tags in a PHP document are formatted as per preferences in tag libraries. You can format the code within PHP blocks with below instructions.
-
Create a new file in the site root with filename as .jsbeautifyrc
-
Copy paste below default formatting rules for CSS, JS, and PHP in .jsbeautifyrc and save the file.
{ "js": { "eol": "\n", "preserve_newlines": true, "max_preserve_newlines": 3, "space_after_anon_function": true, "keep_array_indentation": false, "space_before_conditional": true, "break_chained_methods": false, "unescape_strings": false, "wrap_line_length": 0, "end_with_newline": true, "comma_first": false, "operator_position": "after-newline" }, "css": { "preserve_newlines": false, "selector_separator_newline" : false, "end_with_newline": false, "newline_between_rules": false, "space_around_selector_separator": true }, "php": { "eol": "\n", "preserve_newlines": true, "max_preserve_newlines": 3, "space_after_anon_function": true, "brace_style": "collapse", "keep_array_indentation": false, "space_before_conditional": true, "break_chained_methods": false, "unescape_strings": false, "wrap_line_length": 0, "end_with_newline": false, "comma_first": false, "space_in_paren":true } }
-
Edit the default rules to change the default code formatting rules as per below table and save the changes.
-
Relaunch Dreamweaver and apply code formatting for a CSS, JS, and PHP file.
Code is formatted as per the updated formatting rules.
If you want to customize the code formatting for PHP, CSS, and JS files in other Dreamweaver sites then you need to place the customized file .jsbeautifyrc in the site root folder.
Rules for CSS, JS, and PHP formatting:
CSS | Rules | Default values in Dreamweaver | Description |
preserve_newlines | false | Whether to preserve empty lines. | |
selector_separator_newline | false | Whether to put a newline between comma-separated selectors. For Example: ".div, .P" |
|
end_with_newline | false | Whether to end the file with an empty line. | |
newline_between_rules | false | Whether to add a new line after every CSS rule. | |
space_around_selector_separator | true | To ensure space around selector separators: '>', '+', '~' For Example: "a>b" would become "a > b" on applying source formatting. |
JS | Rules | Default values in Dreamweaver | Description |
"eol" | "\n" | Character used to represent end of line. | |
preserve_newlines | true | Whether to preserve empty lines. | |
max_preserve_newlines | 3 | For "max_preserve_newlines": N, N-1 empty lines are preserved on applying formatting, when more than N-1 empty lines are present in the JS file. Note: max_preserve_newlines is only applicable if preserve_newlines is set to true. |
|
space_after_anon_function | true | Whether to add space before an anonymous function's parenthesis. For Example:"function()" would become "function ()" on applying source formatting. |
|
keep_array_indentation | false | Allow or preserve newline inside array body. | |
space_before_conditional | true | Whether to add a space before a conditional statement For Example: "if(true)" would become "if (true)" on applying formatting. |
|
break_chained_methods | false | Allow or preserve newline between chained functions. For Example: `foobar().baz()` |
|
unescape_strings | false | Should printable characters in strings encoded in \xNN notation be unescaped. For Example: "\x65\x78\x61\x6d\x70\x6c\x65" would become "example" on applying source formatting. |
|
wrap_line_length | 0 | Lines should wrap at next opportunity after these number of characters. | |
end_with_newline | true | To ensure a newline is added at the end of file. |
|
comma_first | false | While breaking a line at comma, this flag is used to ensure comma is the first char of line. | |
operator_position | after-newline | If a long conditional expression is broken into multiple lines then this flag is used to define the position of operators in the lines. You can edit the flag with below values:
|
The rules for PHP formatting are same as for JS formatting (described in above table) with two additional rules given below:
PHP | Rules | Default values in Dreamweaver | Description |
brace_style | collapse | You can control curly brackets position with this option: For Example: function f() { // code } or function f() { // Code } You can assign below values:
|
|
space_in_paren | true | Whether to add spaces inside the parenthesis. For Example: include('header.php') would become include( 'header.php' ) on applying formatting |