We study ultra-diffuse galaxies (UDGs) in zoom in cosmological simulations, seeking the origin of UDGs in the field versus galaxy groups. We find that while field UDGs arise from dwarfs in a characteristic mass range by multiple episodes of supernova feedback (Di Cintio et al. 2017), group UDGs may also form by tidal puffing up and they become quiescent by ram-pressure stripping. The field and group UDGs share similar properties, independent of distance from the group centre. Their dark-matter haloes have ordinary spin parameters and centrally dominant dark-matter cores. Their stellar components tend to have a prolate shape with a Sersic index n~1 but no significant rotation. Ram pressure removes the gas from the group UDGs when they are at pericentre, quenching star formation in them and making them redder. This generates a colour/star-formation-rate gradient with distance from the centre, as observed in clusters. We find that ~20 per cent of the field UDGs that fall into a massive halo survive as satellite UDGs. In addition, normal field dwarfs on highly eccentric orbits can become UDGs near pericentre due to tidal puffing up, contributing about half of the group-UDG population. We interpret our findings using simple toy models, showing that gas stripping is mostly due to ram pressure rather than tides. We estimate that the energy deposited by tides in the bound component of a satellite over one orbit can cause significant puffing up provided that the orbit is sufficiently eccentric.