Working with multicursor support
Have you ever wanted to edit more than one line of code at a time? Dreamweaver offers multicursor support. This feature allows you to select and edit multiple lines of code at once to speed up a variety of mundane tasks. Let’s take a look at how it works.
If necessary, open myfirstpage.html as it appears at the end of the previous exercise.
The file contains a complete webpage with nav, header, main, and footer elements. The content features classes and several paragraphs of placeholder text. The <nav> element includes five placeholders for a navigation menu, but the href attributes are empty. For the menu and links to appear and behave properly, you need to add a filename, URL, or placeholder element to each link. In HTML, the hash mark (#) is used as placeholder content until the final link destinations can be added.
Insert the cursor between the quotation marks in the href="" attribute in Link 1.
Normally, you would have to add a hash mark (#) to each attribute individually. Multicursor support makes this task much easier, but don’t be surprised if it takes you a little practice. Note that all the link attributes are aligned vertically on consecutive lines.
Hold the Alt key (Windows) or Option key (macOS) and drag the mouse down through all five links.
Using the Alt/Option key enables you to select code or insert cursors in consecutive lines. Be careful to drag down in a straight line. If you slip a little to the left or right, you may select some of the surrounding markup. If that happens, you can just start over. When you are finished, you should see a cursor flashing in the href attribute for each link.
Type #
The hash mark (#) appears in all five attributes at the same time.
The Ctrl/Cmd key enables you to select code or insert cursors in nonconsecutive lines of code.
Hold the Ctrl/Cmd key and click to insert the cursor between the p and the > bracket in each of the three opening <p> tags in the <main> element.
Press the spacebar to insert a space, and type class="first"
The attribute appears simultaneously in all three <p> tags.
Save the file.
Multicursor support can save tons of time in repetitive code-editing tasks.