Dreamweaver FIX Removing Extra Line Breaks in CSS HTML PHP

Post 26 of 80

Isn’t it insanely annoying some times when you open a CSS File or a HTML File only to find Dreamweaver has added loads of blank lines, if your CSS is more white space than code then running this script will be very helpful.

I’ve used a tonne of CSS Compressors to fix Dreamweavers fail of blank lines in the past, but most of them do not support CSS 3, and the ones that do – seemingly do not support the transition effect.  This however, works fine with PHP, HTML and CSS (self tested).  So no more tears for those added line breaks in your PHP or CSS, just run this fix!

Open the file in Adobe Dreamweaver, press CTRL+F to load the Find & Replace dialog box (or Edit > Find and Replace).

Do the search on the source code view.

Check the box “Use regular expression” and un-check any other boxes.
Find: [\r\n]{2,}
Replace: \n
The hit “replace all”

It may take a while so fit back and wait whilst your CSS / HTML or PHP Document is flushed of all those annoying line breaks!


> I will not be help responsible for any lost work caused by this quick fix!

Advertise Here


katieMay 2, 2012 at 9:03 pmReply

Oh god, this is a beautiful little trick. Thanks!

LauraMay 11, 2012 at 9:50 amReply

You beauty! Thanks *so* much for this – sorted out a humungous stylesheet that I had inherited :)

PhilJuly 25, 2013 at 5:55 amReply

Super! Works like a charm. Now why? Why does it do this and why is this not more commonly reported. It is so annoying to download (get) and file only to see all these expanded blank lines.

That Web LookJuly 26, 2013 at 11:04 amReply

This is a great trick! Just took reduced my number of lines by about 6x!


ShanSeptember 28, 2014 at 2:33 pmReply

Thanks but it also removes 2’s and Plus so be careful

Mark LawDecember 22, 2014 at 4:53 pmReply

Awesome thanks, this still works and saved me a lot of time :)

MikeMarch 3, 2015 at 5:20 pmReply

Thanks for the tip and helping me clean up my stylesheet!

vipulMarch 25, 2015 at 6:37 amReply

Thanks a ton, I was struggling with this problem for a whole lot of time. This little trick did it all, thanks

TerrySeptember 9, 2015 at 8:03 pmReply

Thank you so much! It works perfectly and now my code is nice and neat again. Awesome!

SriNovember 8, 2015 at 6:40 pmReply

Awesome thanks

Advertise Here