Attenuation of high-energy gamma-rays by pair production with ultraviolet, optical and infrared (IR) extragalactic background light (EBL) photons provides a link between the history of galaxy formation and high-energy astrophysics. We present results from our latest semi-analytic models (SAMs), which employ the main ingredients thought to be important to galaxy formation and evolution, as well as an improved model for reprocessing of starlight by dust to mid- and far-IR wavelengths. These SAMs are based upon a Λ cold dark matter hierarchical structural formation scenario, and are successful in reproducing a large variety of observational constraints such as number counts, luminosity and mass functions and colour bimodality. Our fiducial model is based upon a Wilkinson Microwave Anisotropy Probe 5-year cosmology, and treats dust emission using empirical templates. This model predicts a background flux considerably lower than optical and near-IR measurements that rely on subtraction of zodiacal and galactic foregrounds, and near the lower bounds set by number counts of resolvable sources at a large number of wavelengths. We also show the results of varying cosmological parameters and dust attenuation model used in our SAM. For each EBL prediction, we show how the optical depth due to electron–positron pair production is affected by redshift and gamma-ray energy, and the effect of gamma-ray absorption on the spectra of a variety of extragalactic sources. We conclude with a discussion of the implications of our work, comparisons to other models and key measurements of the EBL and a discussion of how the burgeoning science of gamma-ray astronomy will continue to help constrain cosmology. The low EBL flux predicted by our fiducial model suggests an optimistic future for further studies of distant gamma-ray sources.