  We report the detection of 21-cm absorption from foreground galaxies towards
quasars, specifically z_gal = 0.3120 towards SDSS J084957.97+510829.0 (z_qso =
0.584; Pair-I) and z_gal = 0.3714 towards SDSS J144304.53+021419.3 (z_qso =
1.82; Pair-II). In both the cases, the integrated 21-cm optical depth is
consistent with the absorbing gas being a damped Lyman-\alpha (DLA) system. In
the case of Pair-I, strong Na I and Ca II absorption are also detected at z_gal
in the QSO spectrum. We identify an early-type galaxy at an impact parameter of
b ~ 14 kpc whose photometric redshift is consistent with that of the detected
metal and 21-cm absorption lines. This would be the first example of an
early-type galaxy associated with an intervening 21-cm absorber. The gas
detected in 21-cm and metal absorption lines in the outskirts of this luminous
red galaxy could be associated with the reservoir of cold H I gas with a low
level of star formation activity in the outer regions of the galaxy as reported
in the literature for z ~ 0.1 early-type galaxies. In the case of Pair-II, the
absorption is associated with a low surface brightness galaxy that, unlike most
other known quasar-galaxy pairs (QGPs) i.e. QSO sight lines passing through
disks/halos of foreground galaxies, is identified only via narrow optical
emission lines detected on top of the QSO spectra. Using SDSS spectra we infer
that the emission lines originate within ~ 5 kpc of the QSO sight line, and the
gas has metallicity [12+O/H] ~ 8.4 and star formation rate ~ 0.7-0.8 M_sun per
yr. The measured 21-cm optical depth can be reconciled with the N(H I) we
derive from the measured extinction (A_V=0.6) if either the H I gas is warm or
the extinction per hydrogen atom in this galaxy is much higher than the mean
value of the Small Magellanic Cloud. (Abridged)
