  We use the infrared excess (IRX) FIR/UV luminosity ratio to study the
relation between the effective UV attenuation (A_IRX) and the UV spectral slope
(beta) in a sample of 450 1<z<2.5 galaxies. The FIR data is from very deep
Herschel observations in the GOODS fields that allow us to detect galaxies with
SFRs typical of galaxies with log(M)>9.3. Thus, we are able to study galaxies
on and even below the main SFR-stellar mass relation (main sequence). We find
that main sequence galaxies form a tight sequence in the IRX--beta plane, which
has a flatter slope than commonly used relations. This slope favors a SMC-like
UV extinction curve, though the interpretation is model dependent. The scatter
in the IRX-beta plane, correlates with the position of the galaxies in the
SFR-M plane. Using a smaller sample of galaxies with CO gas masses, we study
the relation between the UV attenuation and the molecular gas content. We find
a very tight relation between the scatter in the IRX-beta plane and the
specific attenuation (S_A), a quantity that represents the attenuation
contributed by the molecular gas mass per young star. S_A is sensitive to both
the geometrical arrangement of stars and dust, and to the compactness of the
star forming regions. We use this empirical relation to derive a method for
estimating molecular gas masses using only widely available integrated
rest-frame UV and FIR photometry. The method produces gas masses with an
accuracy between 0.12-0.16 dex in samples of normal galaxies between z~0 and
z~1.5. Major mergers and sub-millimeter galaxies follow a different S_A
relation.
