beautypg.com

Collapse and expand code fragments, Copy and move collapsed code fragments, Copy and paste a collapsed code fragment – Adobe Dreamweaver CC 2015 User Manual

Page 395: Drag a collapsed code fragment

background image

388

Coding

Last updated 6/3/2015

You can collapse code in HTML, PHP, XML, and SVG files based on tag blocks. In CSS, LESS, Sass, SCSS, and JS files,
you can collapse code based on curly braces.

HTML files: The code between an opening and closing HTML tag is collapsed and the initial attributes, wherever

applicable, are displayed in the collapsed code. The collapsed code block is auto expanded when the code within the
block receives focus through Tag Selector, Find & Replace, Go To Line, Element Quick View, Live View, or
Undo/Redo. Once the selection in these features changes, the code is automatically collapsed back again.

CSS, LESS, SASS, SCSS, and JS files: Code within curly brackets is collapsed and the preview is displayed as {...}.

PHP files: HTML elements, CSS, and JS code blocks are collapsed in addition to PHP code blocks. You can collapse

any PHP code block that begins with .

Note: Files created from Dreamweaver templates display all code as fully expanded, even if the template file (.dwt) contains
collapsed code fragments.

Collapse and expand code fragments

By default, all the code in Code view is in expanded mode. You can specify the minimum number of lines for code
folding in Preferences.

Note: The collapsed or expanded states of code blocks are retained across Dreamweaver sessions.

1

In Code view, hover your mouse over the line number column that corresponds to the code block you want to
collapse or expand . A small triangle appears next to the line numbers.

2

Click the triangle to collapse or expand the code.

To expand all the collapsed code in the document, you can use the keyboard shortcut Control+Alt+E (Win);
Command+Alt+E (Mac).

Copy and move collapsed code fragments

You can copy and paste collapsed code fragments in the same document, or in other documents and applications. You
can also move collapsed code fragments by dragging them in Code view.

Copy and paste a collapsed code fragment

1

Click the collapsed code fragment to select it.

2

Select Edit > Copy.

3

Place the cursor at the point where you want to paste the code.

4

Select Edit > Paste.

Drag a collapsed code fragment

1

Click the collapsed code fragment to select it.

2

Drag the selection to the new location.

To drag a copy of the selection, Control-drag (Windows) or Alt-drag (Macintosh).

Note: You cannot drag code fragments to other documents.