Dreamweaver FIX Removing Extra Line Breaks in CSS HTML PHP

Dreamweaver FIX Removing Extra Line Breaks in CSS HTML PHP

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!

11 Responses

  1. katie says:

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

  2. Laura says:

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

  3. Phil says:

    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.

  4. That Web Look says:

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


  5. Shan says:

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

  6. Mark Law says:

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

  7. Mike says:

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

  8. vipul says:

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

  9. Terry says:

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

  10. Sri says:

    Awesome thanks

  11. Bhavesh Dave says:

    This is awesome.

    Stupid Dreamweaver made my css of 1.8 lac lines, due to this file size goes so huge and it was loading too slow.

    now after this trick its become normal now.

    Thanks Adam.

Leave a Reply

Your email address will not be published. Required fields are marked *