The total density profiles of elliptical galaxies can be fit by a single power law, i.e., ρtot ∝ rγ with γ ≈ −2. While strong lensing observations show a tendency for the slopes to become flatter with increasing redshift, simulations indicate an opposite trend. To understand this discrepancy, we study a set of simulated spheroids formed within the cosmological framework. From our simulations we find that the steepness of the total density slope correlates with the compactness of the stellar component within the half-mass radius, and that spheroidal galaxies tend to be more compact at high redshifts than their present-day counterparts. While both these results are in agreement with observations, the observed trend of the total density slope with redshift remains in contradiction to the results from simulations.