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!


1 Response

Comments

  • 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.

Add a Comment

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