Installing El Capitan on a new SSD
If your HDD is still mounted you can download El Capitan from the Apple App Store and create a USB installer thumb drive:


Download the OS X installer from the Mac App Store. Quit the installer if it opens automatically after downloading. The installer will be in your Applications folder.
Mount your USB flash drive or other volume. You could also use a secondary internal partition. Partition the thumb drive with Disk Utility: one partition, Mac OS X Extended Journaled and GUID partition table and rename it (e.g. MyVolume).
Open the Terminal app, which is in the Utilities folder of your Applications folder.
Use the createinstallmedia command in Terminal to create the bootable installer. Examples of this command are in the next section. For detailed usage instructions, make sure that the appropriate Install OS X app is in your Applications folder, then enter one of the following paths in Terminal:

#with MyVolume: the name of your USB thumb drive volume
sudo /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolume --applicationpath /Applications/Install\ OS\ X\ El\ Capitan.app

Shutdown your Mac and replace the hard drive.
Boot your Mac - you may have to hold the alt/opt and choose the installer thumb drive as boot volume. Sometimes this doesn't work on the first attempt. Just reboot again!
Partition the SSD with Disk Utility which is included in the installer thumb drive(AFAIR in the menubar -> Utilities): one partition, Mac OS X Extended Journaled and GUID partition table and rename it (e.g. Macintosh HD). Quit Disk Utility and install El Capitan.


If you already attached the SSD you can use Internet Recovery Mode (hold cmdR or altcmdR while booting) to first partition the new internal drive and then restore the original system (10.7 Lion). Then - after configuring Lion - you can to upgrade to El Capitan. This is not recommended because it takes at least twice the time/download.