We aim at investigating whether the chemical composition of the outer region of the protosolar nebula can be consistent with current estimates of the elemental abundances in the ice giants. To do so, we use a self-consistent evolutionary disc and transport model to investigate the time and radial distributions of H2O, CO, CO2, CH3OH, CH4, N2 and H2S, i.e. the main O-, C-, N and S-bearing volatiles in the outer disc. We show that it is impossible to accrete a mixture composed of gas and solids from the disc with a C/H ratio presenting enrichments comparable to the measurements (approx. 70 times protosolar). We also find that the C/N and C/S ratios measured in Uranus and Neptune are compatible with those acquired by building blocks agglomerated from solids condensed in the 10-20 arb. units region of the protosolar nebula. By contrast, the presence of protosolar C/N and C/S ratios in Uranus and Neptune would imply that their building blocks agglomerated from particles condensed at larger heliocentric distances. Our study outlines the importance of measuring the elemental abundances in the ice giant atmospheres, as they can be used to trace the planetary formation location, the origin of their building blocks and/or the chemical and physical conditions of the protosolar nebula. This article is part of a discussion meeting issue 'Future exploration of ice giant systems'.