I have no such problems connecting to a web server when it's actually listening on port 80.
If you have no web server running, here is what you should get from terminal to show that name resolution is working on all network interfaces before the telnet gives up connecting to port 80:
mac:~ me$ telnet localhost 80
telnet: connect to address ::1: Connection refused
telnet: connect to address 127.0.0.1: Connection refused
telnet: connect to address fe80::1: Connection refused
telnet: Unable to connect to remote host
Should you get different results, I would use scutil to determine reachability for your network destination:
mac:~ me$ scutil -r localhost
mac:~ me$ scutil -r loopback
mac:~ me$ scutil -r 127.0.0.1
It might be worth checking if you have LittleSnitch or another firewall that has rules that are blocking network access or reboot into Safe mode to test if some kernel extensions or other conflict is preventing the default reachability and access to local ports. Also, you will most certainly want to check whatever web server you are running to ensure it's really listening to port 80:
mac:~ me$ sudo lsof -i :80 | egrep "PID|LISTEN"
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 1645 root 8u IPv6 0x513627eaa81c8205 0t0 TCP *:http (LISTEN)
httpd 15851 _www 8u IPv6 0x513627eaa81c8205 0t0 TCP *:http (LISTEN)
httpd 72969 _www 8u IPv6 0x513627eaa81c8205 0t0 TCP *:http (LISTEN)
Also, quit all web browsers or be prepared to filter those network connections from the above
lsof command as it shows all connections over port 80.