Over the years, I have never understood why some files that are not double-spaced, mysteriously open with a line space between each line of code in Dreamweaver. I used to take the tedious time hitting “Backspace” and the up arrow key in rapid fire manner to get back to beautiful single-spaced code.
However, since learning how to do regular expression searches, I can now share with you how to get rid of these extra lines.
Steps to removing double spacing from Dreamweaver code:
- Open “Find and Replace” in Dreamweaver
- Check “Use Regular Expressions”
- Enter [rn]{2,} in the find box. This will search for double line breaks in your code.
- Enter n in the replace box. This replaces the double line break with a single break.
- Press “Replace All” and you’re good to go!
Want to make sure this doesn’t happen again?
Steps to prevent Dreamweaver from inserting blank lines or double spaces in the future:
- In Dreamweaver, go to “Preferences”
- Go to “Code Format” on the left hand side
- Change the “Line Break Type” to match your server’s operating system. In most cases, this is Linux.