How to Get Rid of Empty Lines in Your CSS and PHP Files

extra lines in css and php file

WordPress has this problem—especially if you use its built-in “Theme Editor” and “Plugin Editor” features—where CSS, PHP, JavaScript, and other code and markup files start getting one or more empty lines between every line of actual content.

Here’s a very easy text editor trick to fix that problem when it arises.

This even works for files with multiple useless empty lines per line, like this:

function ask_why() {

echo 'Seriously, ';

echo 'why?';


Just take the trick in the video and repeat as many times as you need to. Cheers!

2 Responses


  • Mark says:

    Multiple line spacing often happens because FileZilla is not using binary transfer mode. It usually occurs when the data is transferred over FTP, in ASCII mode. In FileZilla the setting is in Edit > Settings > Transfers > File Types > Default transfer type > Binary.

  • Christina says:

    You are a lifesaver lol!! Funny how such a simple thing could be so frustrating and so easily fixed. And I’m not sure of WHY it happens, but I have noticed it happens with my FTP files in FileZilla, so Mark may be on to something.

Add a Comment

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