In this paper, we present a model of the formation and chemical enrichment of elliptical galaxies that differs from the conventional picture in two fundamental ways. (i) Ellipticals do not form in 3. single monolithic collapse and burst of star formation at high redshift. Instead, most of their stars form at modest rates in disc galaxies, which then merge to form the ellipticals. (ii) Galaxies do not undergo 'closed-box' chemical evolution. Instead, metals can be transferred between the stars, cold gas and hot gas haloes of the galaxies. It is assumed that metals are ejected out of disc galaxies during supernova explosions and that these metals enter the hot gas component. The fact that metals are more easily ejected from small galaxies leads to the establishment of a mass-metallicity relation for the disc systems. Large ellipticals are more metal-rich because they are formed from the mergers of larger discs. We use semi-analytic techniques to follow the formation, evolution and chemical enrichment of cluster elliptical galaxies in a merging hierarchy of dark matter haloes. The inclusion of the new metallicity-dependent spectral synthesis models of Bruzual & Chariot enables us to compute the colours, line indices and mass-to-light ratios of these galaxies. We find that with physically realistic parameters and with the assumption that feedback is efficient, even in massive galaxies, we are able to reproduce the slope and scatter of the colour-magnitude and the Mg-2-sigma relations for cluster ellipticals. Bright field ellipticals have the same metallicities but are younger than their cluster counterparts, and thus exhibit more scatter in the equivalent widths of their Balmer absorption lines. We are not able to match the increase in M/L for bright ellipticals if we assume their mass to measure purely the total quantity of stars in these objects. WE: also study the evolution of these relations to high redshift. We show that the luminosity-metallicity relation does not change with redshift, but the mean stellar age of the galaxies scales with the age of the Universe. This is why the evolution of cluster ellipticals appears to be well described by simple passive evolution. Finally, vie study the enrichment history of the intracluster gas. Our models predict that more than 80 per cent of the metals were ejected by galaxies with circular velocities less than 250 km s(-1) at redshifts greater than 1. The metallicity of the intracluster medium is thus predicted to evolve very little out to z > 1.