  We use a sample of 706 galaxies, selected as [OII]$\lambda$3727 ([OII])
emitters in the Survey for High-$z$ Absorption Red and Dead Sources (SHARDS) on
the CANDELS/GOODS-N field, to study the differential attenuation of the nebular
emission with respect to the stellar continuum. The sample includes only
galaxies with a counterpart in the infrared and
$\mathrm{log}_{10}(M_{*}/\mathrm{M}_{\odot})$ $>$ 9, over the redshift interval
0.3 $\lesssim$ $z$ $\lesssim$ 1.5. Our methodology consists in the comparison
of the star formation rates inferred from [OII] and H$\alpha$ emission lines
with a robust quantification of the total star-forming activity
(${SFR}_{\mathrm{TOT}}$) that is independently estimated based on both infrared
and ultraviolet (UV) luminosities. We obtain
$f$$=$$E(B-V)_{\mathrm{stellar}}$/$E(B-V)_{\mathrm{nebular}}$ $=$
0.69$^{0.71}_{0.69}$ and 0.55$^{0.56}_{0.53}$ for [OII] and H$\alpha$,
respectively. Our resulting $f$-factors display a significant positive
correlation with the UV attenuation and shallower or not-significant trends
with the stellar mass, the $SFR_{\mathrm{TOT}}$, the distance to the main
sequence, and the redshift. Finally, our results favour an average nebular
attenuation curve similar in shape to the typical dust curve of local
starbursts.
