Working with a localhost has many benefits that make designing for web much more efficient. So let's take a look at what working locally actually means when it comes to the web.
Localhost is really just the standard host name given to the address of the local computer. If you're using localhost, that simply means you're using the server on your personal computer to host the website. The IP address for your localhost is 127.0.0.1, which is considered to be a loopback address, since the information is looped or sent back to the same machine.
If you're just getting started in web design, you've probably already been working locally. The local server isn't connected to the internet, but makes it possible to see your site in the browser as if you're viewing it online. Seeing the changes through your own computer means you're working locally.
Using a hosting service where you're pushing your work with something like File Transfer Protocol (FTP), like FileZilla, would be the opposite of working locally. If you're using FTP, it simply means you're using it to transfer computer files from one host to another host.
So, if you haven't purchased a domain name or any hosting how can you show someone else (who's not right next to you) your site? It's pretty simple actually. When you create a file with the extension .html, by default it will open it up in your default browser. For someone to see all the work you've done with CSS and HTML, you'll have to send them the entire directory for your site. A great way to do this is through GitHub, Dropbox or Google Drive.
Once they have all your files on their computer they'll be able to click through your site just like you did.
Working locally is a wonderful way to get your ideas for you site in the browser without worrying about anyone else stumbling across it. Most work on websites is first done locally before it's "pushed' to a working server that other people can access by visiting its URL. It's also much faster to work locally, since you can see your changes almost instantly. You can also work more efficiently without the need to be connected to the internet.
Creating a static site with the local host is easy. All you have to do is choose to open your .html file in the browser and the work you've done, if you've set your files up correctly, will show up!
If you're working with server-side languages in your site, like PHP or MySQL, to create a dynamic site, it's still possible to work locally, it just will require a couple other steps. The main reason for this is you'll need to create a database on your computer that stores your information and you'll have to create a way for your computer to communicate with it. Usually this is done through MAMP (Mac), WAMP (Windows), or XAMPP (all operating systems).