Observations of the distant universe depend on corrections for extinction by dust in the foreground. However, the properties of dust in distant galaxies are not as well-known as the dust in nearby galaxies. We have started a systematic study of dust in galaxies using the spectra of background sources such as quasars. This includes a study of dust extinction based on optical and infrared data for 30 dusty quasars with foreground absorbers at redshifts 0 < z < 2.4. To combine the extinction information with the composition of dust grains, we investigate depletions of refractory elements in these absorbers relative to volatile elements. To measure the depletions and metallicities, we use archival ultraviolet (UV) and optical spectra. The archival HST spectra were obtained with the Cosmic Origins Spectrograph, the Space Telescope Imaging Spectrograph, and the Faint Object Spectrograph. The optical spectra were obtained from the Keck Observatory Archive where available, and from the Sloan Digital Sky Survey (SDSS) in other cases. The Linetools spectral analysis package was used to fit the continuum of each quasar and to measure the absorption lines of a number of elements (H, C, N, O, S, Si, Mg, Fe, Zn, etc.). The metal column densities were measured using the apparent optical depth method and used to calculate absolute abundances as well as abundances relative to volatile elements such as Zn. These measurements, combined with estimates of extinction of the background quasars (obtained by fitting the quasar spectra with a quasar template reddened by dust at the redshift of the foreground absorber), can be used to investigate how metallicity and dust depletions correlate with dust extinction. This research was funded in part by NASA grants NNX17AJ26G and 80NSSC20K0887.