The age and metallicity gradients for a sample of group and cluster galaxies from N-body+hydrodynamical simulation are analysed in terms of galaxy stellar mass. Dwarf galaxies show null age gradient with a tail of high and positive values for systems in groups and cluster outskirts. Massive systems have generally zero-age gradients which turn to positive for the most massive ones. Metallicity gradients are distributed around zero in dwarf galaxies and become more negative with mass; massive galaxies have steeper negative metallicity gradients, but the trend flattens with mass. In particular, fossil groups are characterized by a tighter distribution of both age and metallicity gradients. We find a good agreement with both local observations and independent simulations. Interestingly, our results suggest that environment differently affects the gradients at low and high masses. The results are also discussed in terms of the central age and metallicity, as well as the total colour, specific star formation and velocity dispersion.