Probing the connection between the intergalactic medium and galaxies with quasar absorption-line spectroscopy